<template>
  <div id="mains" style="min-width: 1000px">
    <!-- 这里就是右边渲染部分 -->
    <!-- 无数据时 -->
    <div
      v-if="directoryList.length === 0"
      style="height: 80vh; width: 300px"
      class="noData-2"
    >
      <div class="noData">
        <div class="noData-1">暂无数据</div>
      </div>
    </div>
    <div v-else>
      <vuedraggable
        v-model="directoryList"
        group="groupsss"
        animation="300"
        drag-class="dragClass"
        ghost-class="ghostClass"
        chosen-class="chosenClass"
        @start="newwraponStart"
      >
        <div v-for="(moduleList, index) in directoryList" :key="index">
          <!-- 一级变量 -->
          <div :style="index===0?'padding-top:0 !important;':''" style="display:flex;justify-content:space-between;align-items:center;padding:50px 20px 10px 20px;">
            <h3 style="margin: 0px;">
              {{ moduleList.item_name }}
            </h3>
            <el-dropdown v-if="moduleList.second_item.length === 0" @command="deletedModels(moduleList)">
              <span class="el-dropdown-link">
                <i class="el-icon-more" />
              </span>
              <el-dropdown-menu slot="dropdown">
                <el-dropdown-item>删除模块
                </el-dropdown-item>
              </el-dropdown-menu>
            </el-dropdown>
          </div>
          <!-- 二级变量 -->
          <div>
            <vuedraggable
              v-model="moduleList.second_item"
              :style="moduleList.second_item.length==0?'width:100%;height:50px':''"
              :group="newssecondSite"
              :animation="index"
              drag-class="dragClass"
              ghost-class="ghostClass"
              chosen-class="chosenClass"
              @start="onStart"
              @change="twosVariable"
            >
              <div
                v-for="(twoVariable, twoIndex) in moduleList.second_item"
                :key="twoIndex"
              >
                <div class="item-name pointer" @click="incalids(twoVariable)">
                  <div>
                    <i :class="twoVariable.invalid_parameter?'el-icon-caret-right':'el-icon-caret-bottom'" style="font-size:16px;" />
                    <span>{{ twoVariable.item_name }}</span>
                  </div>
                  <el-dropdown>
                    <span class="el-dropdown-link">
                      <i class="el-icon-more" />
                    </span>
                    <el-dropdown-menu slot="dropdown">
                      <el-dropdown-item
                        @click.native="newdeleteVarisible(twoVariable)"
                      >删除模块
                      </el-dropdown-item>
                    </el-dropdown-menu>
                  </el-dropdown>
                </div>
                <el-collapse-transition>
                  <!-- 回答部分 -->
                  <div v-show="!twoVariable.invalid_parameter" style="background: #fff;font-size:14px;">
                    <vuedraggable
                      v-model="twoVariable.question_lists"
                      class="wrap"
                      :group="newSites ? 'site' : is_group? 'site' : newVariable? 'site': twoVariable.item_id === 0? twoVariable.question_name: twoVariable.item_id "
                      animation="300"
                      drag-class="dragClass"
                      ghost-class="ghostClass"
                      chosen-class="chose-child-class"
                      :sort="newAnswerSome"
                      style="width:100%;display:flex;;flex-wrap:wrap;"
                      @start="newsOnStarts"
                      @change="AnswerSome"
                      @end="newAnswerSomes"
                    >
                      <div
                        v-for=" answer in twoVariable.question_lists"
                        :key="answer.relation_question_id"
                        class="wrap-main"
                        :class="{'dimensionless border-b-none':answer.question_type == 0}"
                        :style="{width:answer.question_type== 0 ?'100%':'50%',}"
                      >

                        <!-- 等于0是 变量组 -->
                        <el-col v-if="answer.question_type == 0" style="height:100%;" :span="24" class="dimensionless">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="3" style="border-left:1px solid rgba(220, 223, 230, 0.5);">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <!-- 这里是变量组的编辑和删除需要另外写 -->
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariables(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="21" class="grid-content">
                                <div v-if="answer.child_question" class="grid-content-align">
                                  <el-row class="grid-main">
                                    <vuedraggable
                                      v-model="answer.child_question"
                                      class="wrap"
                                      :group="newSites?'site': is_group? 'site2': newsisGroup?'site': twoVariable.item_id === 0? twoVariable.question_name: twoVariable.item_id"
                                      animation="300"
                                      style="width:100%;display:flex;;flex-wrap:wrap;"
                                      drag-class="dragClass"
                                      ghost-class="ghostClass"
                                      chosen-class="chose-child-class"
                                      @start="onStarts"
                                      @change="newAnswerSomelist"
                                    >
                                      <div
                                        v-for="newchild in answer.child_question"
                                        :key="newchild.question_id"
                                        class="wrap-main"
                                        :style="{width:'50%'}"
                                      >

                                        <!-- 等于1是单选 -->
                                        <el-col v-if="newchild.question_type == 1" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div v-if="newchild.option_list" class="grid-content-align">
                                                  <div
                                                    v-for="list in newchild.option_list"
                                                    :key="list.option_id"
                                                    style="padding:8px;"
                                                  >
                                                    <el-radio
                                                      v-model="newfilesterlist"
                                                      disabled
                                                      :label="list.question_name"
                                                    >
                                                      {{ list.option_name }}
                                                    </el-radio>
                                                  </div>
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于2是多选 -->
                                        <el-col v-else-if="newchild.question_type == 2" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div v-if="newchild.option_list" class="grid-content-align">
                                                  <el-checkbox-group
                                                    v-for="lists in newchild.option_list"
                                                    :key="lists.option_id"
                                                    v-model="newfilesterlist"
                                                  >
                                                    <el-checkbox
                                                      class="grid-content-align-checkbox"
                                                      disabled
                                                      :label="lists.question_id"
                                                    >
                                                      {{ lists.option_name }}
                                                    </el-checkbox>
                                                  </el-checkbox-group>
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于3是下拉 -->
                                        <el-col v-else-if="newchild.question_type == 3" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div class="grid-content-align">
                                                  <el-cascader
                                                    disabled
                                                    :options="newchild.option_list"
                                                  />
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于4是附件上传 -->
                                        <el-col v-else-if="newchild.question_type == 4" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div class="grid-content-align">
                                                  <el-upload
                                                    class="upload-demo"
                                                    action="#"
                                                    multiple
                                                    :limit="3"
                                                    disabled
                                                  >
                                                    <el-button
                                                      size="small"
                                                      type="primary"
                                                      disabled
                                                    >点击上传</el-button>
                                                  </el-upload>
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于5是单行文本 -->
                                        <el-col v-else-if="newchild.question_type == 5" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div class="grid-content-align">
                                                  <el-input
                                                    disabled
                                                    style="width: 150px"
                                                  />
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于6是多行文本 -->
                                        <el-col v-else-if="newchild.question_type == 6" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div class="grid-content-align">
                                                  <el-input
                                                    type="textarea"
                                                    :rows="2"
                                                    disabled
                                                    style="width: 150px; margin-left: 10px"
                                                    placeholder="请输入内容"
                                                  />
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>
                                        <!-- 等于7是时间 -->
                                        <el-col v-else-if="newchild.question_type == 7" style="height:100%;" :span="24">
                                          <div class="grid-child">
                                            <el-row class="grid-child-row" type="flex" align="center">
                                              <el-col :span="6">
                                                <div class="grid-content-name-align">
                                                  <!-- 这里就是操作元素隐藏显示 -->
                                                  <div class="grid-content-name-align-left"><span>{{ newchild.question_name }}</span></div>
                                                  <template>
                                                    <div class="tool">
                                                      <el-dropdown>
                                                        <span
                                                          class="el-dropdown-link"
                                                          style="position: relative"
                                                        >
                                                          <i
                                                            class="el-icon-more"
                                                            style="
                                            position: absolute;
                                            top: 0;
                                            right: 3px;
                                          "
                                                          />
                                                        </span>
                                                        <div v-if="answer.create_type === 1">
                                                          <el-dropdown-menu slot="dropdown">
                                                            <el-dropdown-item
                                                              icon="el-icon-edit"
                                                              @click.native="
                                                                neweditVariable(newchild, answer)
                                                              "
                                                            >编辑变量
                                                            </el-dropdown-item>
                                                            <el-dropdown-item
                                                              icon="el-icon-delete"
                                                              @click.native="
                                                                newdeleteVarisible(newchild)
                                                              "
                                                            >删除变量
                                                            </el-dropdown-item>
                                                          </el-dropdown-menu>
                                                        </div>
                                                      </el-dropdown>
                                                    </div>
                                                  </template>
                                                </div>
                                              </el-col>
                                              <el-col :span="18" class="grid-content">
                                                <div class="grid-content-align">
                                                  <div
                                                    style="margin-left: 10px;display: flex;align-items: center;"
                                                  >
                                                    <el-date-picker
                                                      v-model="newchild.question_type"
                                                      disabled
                                                      placeholder="选择日期时间"
                                                    />
                                                  </div>
                                                </div>
                                              </el-col>
                                            </el-row>
                                          </div>
                                        </el-col>

                                      </div>
                                    </vuedraggable>
                                  </el-row>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于1是单选 -->
                        <el-col v-else-if="answer.question_type == 1" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div v-if="answer.option_list" class="grid-content-align">
                                  <div
                                    v-for="list in answer.option_list"
                                    :key="list.option_id"
                                    style="padding:8px;"
                                  >
                                    <el-radio
                                      v-model="newfilesterlist"
                                      disabled
                                      :label="list.question_name"
                                    >
                                      {{ list.option_name }}
                                    </el-radio>
                                  </div>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于2是多选 -->
                        <el-col v-else-if="answer.question_type == 2" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div v-if="answer.option_list" class="grid-content-align">
                                  <el-checkbox-group
                                    v-for="lists in answer.option_list"
                                    :key="lists.option_id"
                                    v-model="newfilesterlist"
                                    style="padding:8px;"
                                  >
                                    <el-checkbox class="grid-content-align-checkbox" disabled :label="lists.question_id">
                                      {{ lists.option_name }}
                                    </el-checkbox>
                                  </el-checkbox-group>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于3是下拉 -->
                        <el-col v-else-if="answer.question_type == 3" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div v-if="answer.option_list" class="grid-content-align">
                                  <el-cascader disabled :options="answer.option_list" />
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于4是附件上传 -->
                        <el-col v-else-if="answer.question_type == 4" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div class="grid-content-align">
                                  <el-upload
                                    class="upload-demo"
                                    action="#"
                                    multiple
                                    :limit="3"
                                    disabled
                                  >
                                    <el-button
                                      size="small"
                                      type="primary"
                                      disabled
                                    >点击上传</el-button>
                                  </el-upload>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于5是单行文本 -->
                        <el-col v-else-if="answer.question_type == 5" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div class="grid-content-align">
                                  <el-input
                                    disabled
                                    placeholder="请输入内容"
                                    style="width: 150px; margin-left: 10px"
                                  />
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于6是多行文本 -->
                        <el-col v-else-if="answer.question_type == 6" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div class="grid-content-align">
                                  <el-input
                                    type="textarea"
                                    :rows="2"
                                    disabled
                                    style="width: 150px; margin-left: 10px"
                                    placeholder="请输入内容"
                                  />
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                        <!-- 等于7是时间 -->
                        <el-col v-else-if="answer.question_type == 7" style="height:100%;" :span="24">
                          <div class="grid-child">
                            <el-row class="grid-child-row" type="flex" align="center">
                              <el-col :span="6">
                                <div class="grid-content-name-align">
                                  <!-- 这里就是操作元素隐藏显示 -->
                                  <div class="grid-content-name-align-left"><span>{{ answer.question_name }}</span></div>
                                  <template>
                                    <div class="tool">
                                      <el-dropdown>
                                        <span
                                          class="el-dropdown-link"
                                          style="position: relative"
                                        >
                                          <i
                                            class="el-icon-more"
                                            style="position: absolute; top: 0; right: 3px"
                                          />
                                        </span>
                                        <div v-if="answer.create_type === 1">
                                          <el-dropdown-menu slot="dropdown">
                                            <el-dropdown-item
                                              icon="el-icon-edit"
                                              @click.native="
                                                neweditVariable(answer, twoVariable)
                                              "
                                            >编辑变量
                                            </el-dropdown-item>
                                            <el-dropdown-item
                                              icon="el-icon-delete"
                                              @click.native="newdeleteVarisible(answer)"
                                            >删除变量
                                            </el-dropdown-item>
                                          </el-dropdown-menu>
                                        </div>
                                      </el-dropdown>
                                    </div>
                                  </template>
                                </div>
                              </el-col>
                              <el-col :span="18" class="grid-content">
                                <div class="grid-content-align">
                                  <div
                                    style="margin-left: 10px;display: flex;align-items: center;"
                                  >
                                    <el-input v-model="demo_time" disabled prefix-icon="el-icon-time" size="normal" style="width:200px" />
                                  </div>
                                </div>
                              </el-col>
                            </el-row>
                          </div>
                        </el-col>
                      </div>
                    </vuedraggable>
                  </div>
                </el-collapse-transition>
              </div>
            </vuedraggable>
          </div>
        </div>
      </vuedraggable>
    </div>
    <!-- 新增模块/变量 -->
    <div class="navthiss">
      <div class="navthiss-header pointer">
        <div
          style="display:flex;justify-content:center;align-items:center;"
          :class="{ 'navthiss-header-select': is_slect_item }"
          @click="changeSlectItem(1)"
        >
          <span style="color: #333;">变量</span>
        </div>
        <div
          style="display:flex;justify-content:center;align-items:center;"
          :class="{ 'navthiss-header-select': !is_slect_item }"
          @click="changeSlectItem(0)"
        >
          <span style="color: #333;">模块</span>
        </div>
      </div>
      <!-- 模块 -->
      <div v-if="!is_slect_item" class="navthiss-content">
        <!-- <div class="navthiss-content-add pointer" @click="newAddBlock(0)">
          新增模块
        </div> -->
        <vuedraggable
          v-model=" module_move_arr"
          group="second-site"
          animation="100"
          drag-class="dragClass"
          ghost-class="ghostClass"
          chosen-class="navthiss-chose-class-module"
          :scroll="true"
          @start="onStartMove"
          @end="onEndsMove"
        >
          <div class="navthiss-content-add" style="cursor:move;">
            <img src="@/assets/images/png/addtional.png" style="width:16px;height:16px;margin-right:5px;">
            <span>新增模块</span>
          </div>
        </vuedraggable>
        <div style="heigh:40px;width:100%;font-size:14px;line-height:40px;padding-left:10px;color:rgba(0,0,0,0.5)">系统提供的模块</div>
        <vuedraggable
          v-model="second_items_add"
          class="wrap"
          group="second-site"
          animation="100"
          drag-class="dragClass"
          ghost-class="ghostClass"
          chosen-class="navthiss-chose-class-module"
          :scroll="true"
          @start="onStart"
          @end="onEnds"
          @choose="newchoose"
          @change="newHandleRemoves"
        >
          <!-- <transition-group> -->
          <div
            v-for="item in second_items_add"
            :key="item.item_id"
            class="navthiss-content-item2"
            :class="{'select-module':select_module_id==item.item_id}"
            @click.stop="selectModuleId(item.item_id)"
          >
            <img :src="select_module_id==item.item_id?module_logo_bule:module_logo" style="width:16px;height:16px;margin-right:10px;">
            <span>{{ item.item_name }}</span>
          </div>
          <!-- </transition-group> -->
        </vuedraggable>
        <!-- <div>模块1</div>
        <div>模块2</div> -->
      </div>
      <!-- 变量 -->
      <div v-else class="navthiss-content">
        <!-- <div class="navthiss-content-add" @click="newAddBlock(1)">
          新增变量
        </div> -->
        <vuedraggable
          v-model="items"
          style="margin-top:28px;"
          class="wrap"
          :group="newSiteList"
          animation="100"
          drag-class="dragClass"
          ghost-class="ghostClass"
          chosen-class="navthiss-chose-class"
          :scroll="true"
          @change="newHandleRemove"
          @start="newresonStart"
          @end="onEnd"
        >
          <div
            v-for="item in items"
            :key="item.question_type"
            class="navthiss-content-item2"
            :class="{'select-module':item.is_select}"
            @click.stop="selectVariableId(item)"
          >
            <img :src="variable_logo" style="width:8px;height:8px;margin-right:10px;">
            <span>{{ item.question_name }}</span>
          </div>
        </vuedraggable>
      </div>
    </div>
    <!-- 模块/变量 -->
    <el-dialog
      :title="new_add_id===0?'新建CRF':'新增变量'"
      :visible.sync="block_varible"
      width="30%"
      center
      append-to-body
      @close="blockClose"
    >
      <!-- 模块 -->
      <el-form v-if="new_add_id===0" ref="reBlockForm" :model="reBlockForm" :rules="block_rules" label-width="100px" class="demo-ruleForm">
        <el-form-item label="CRF表" prop="name">
          <el-input v-model="reBlockForm.name" style="width: 200px" />
        </el-form-item>
        <el-form-item label="CRF组" prop="block_select">
          <el-radio-group v-model="reBlockForm.block_select">
            <el-radio
              v-for="(cur_module,index) in cur_module_arr"
              :key="'cur_module'+index"
              :label="index+''"
            >{{ cur_module.item_name }}</el-radio>
            <el-radio :label="cur_module_arr.length+1+''">
              新增组
              <el-input v-if="reBlockForm.block_select==cur_module_arr.length+1" v-model="reBlockForm.new_block_select" placeholder="请输入组名" size="mini" style="width:130px;height:20px" clearable />
            </el-radio>
          </el-radio-group>
          <!-- <el-select v-if="cur_module_arr.length>0" v-model="reBlockForm.block_select" placeholder="请选择">
            <el-option v-for="(cur_module,index) in cur_module_arr" :key="'cur_module'+index" :label="cur_module.item_name" :value="index+''" />
          </el-select>
          <el-input v-else v-model="reBlockForm.block_select" style="width: 200px" /> -->
        </el-form-item>
      </el-form>
      <!-- 变量 -->
      <el-form v-else ref="newruleForm" :model="newAddBlockForm">
        <el-form-item prop="name" label="名字" :required="true">
          <el-input v-model="newAddBlockForm.name" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer">
        <el-button @click="block_varible = false">取消</el-button>
        <el-button type="primary" @click="newAddBlockConfirm">确定</el-button>
      </span>
    </el-dialog>

    <!-- 添加变量弹框 -->
    <el-dialog
      title="添加变量"
      append-to-body
      center
      :visible.sync="addVisible"
      width="40%"
      @close="addVisibleClose"
    >
      <el-form
        ref="ruleForm"
        :model="ruleForm"
        :rules="rules"
        label-width="100px"
        class="demo-ruleForm"
      >
        <el-form-item label="变量名称" prop="name">
          <el-input v-model="ruleForm.name" style="width: 200px" />
        </el-form-item>
        <el-form-item label="变量描述">
          <el-input v-model="ruleForm.date1" style="width: 200px" />
        </el-form-item>
        <el-form-item label="题目类型" prop="resource">
          <el-radio-group v-model="ruleForm.resource">
            <el-radio label="1">单选</el-radio>
            <el-radio label="2">多选</el-radio>
            <el-radio
              label="3"
              :disabled="newclickable === true"
            >下拉</el-radio>
            <el-radio
              label="4"
              :disabled="newclickable === true"
            >附件上传</el-radio>
            <el-radio
              :label="ruleForm.resource=='6'?'6':'5'"
              :disabled="newclickable === true"
            >文本框</el-radio>
            <el-radio
              label="7"
              :disabled="newclickable === true"
            >时间</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 单选||多选 -->
        <div v-if="ruleForm.resource == 1 || ruleForm.resource == 2">
          <el-form-item label="选项" prop="text">
            <!-- 单个选项 -->
            <div
              v-for="(item, index) in ruleForm.questionDescribe"
              :key="index + 1214"
              style="margin-bottom: 5px"
            >
              <el-input v-model="item.text" style="width: 200px" />
              <span
                style="margin-left: 10px"
                @click="minusSingleItem(item, index)"
              >x</span>
              <span
                v-if="index == 0"
                style="margin-left: 70px; color: red"
                @click="batch"
              >批量操作</span>
            </div>
          </el-form-item>
          <el-form-item label="">
            <el-button
              type="text"
              size="default"
              @click="addSingleItem(1)"
            >+添加单个选项</el-button>
            <el-button
              type="text"
              size="default"
              @click="addSingleItem(2)"
            >+添加[其他]项</el-button>
          </el-form-item>
        </div>
        <div v-else-if="ruleForm.resource == 3">
          <el-form-item label="选项" prop="text">
            <!-- 单个选项 -->
            <div
              v-for="(item, index) in ruleForm.questionDescribe"
              :key="index + 1214"
              style="margin-bottom: 5px"
            >
              <el-input v-model="item.text" style="width: 200px" />
              <span
                style="margin-left: 10px"
                @click="minusSingleItem(item, index)"
              >x</span>
            </div>
          </el-form-item>
          <el-form-item label="">
            <el-button
              type="text"
              size="default"
              @click="addSingleItem(1)"
            >+添加单个选项</el-button>
          </el-form-item>
        </div>
        <!-- 附件上传 -->
        <div v-else-if="ruleForm.resource == 4">
          <el-upload
            class="upload-demo"
            action="#"
            multiple
            :limit="3"
            disabled
          >
            <el-button size="small" type="primary" disabled>点击上传</el-button>
          </el-upload>
        </div>
        <!-- 文本 -->
        <div v-else-if="ruleForm.resource == 5||ruleForm.resource == 6">
          <el-form-item label="选项">
            <!-- <el-input v-model="ruleForm.desc" style="width:200px;" /> -->
            <el-select v-model="textInputValue" placeholder="请选择">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-input
              v-model="ruleForm.desc"
              :type="textInputValue == 2 ? 'textarea' : ''"
              style="width: 200px"
            />
          </el-form-item>
        </div>
        <div v-else-if="ruleForm.resource == 7">
          <div class="block">
            <span class="demonstration" />
            <!-- <el-date-picker
              v-model="demo_time"
              disabled
              type="text"
              placeholder="选择日期时间"
            /> -->
            <el-input v-model="demo_time" disabled prefix-icon="el-icon-time" size="normal" style="width:200px" />

          </div>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="addVisibleClose">取 消</el-button>
        <el-button type="primary" @click="makeSure">确定</el-button>
      </span>
    </el-dialog>
    <!-- 批量修改弹框 -->
    <el-dialog
      title="批量修改选项"
      center
      append-to-body
      :visible.sync="mostDialogVisible"
      width="30%"
      @close="mostColse"
    >
      <span>每一行代表一个选项，可以添加多个选项</span>
      <el-input
        v-model="mostData"
        placeholder="请输入内容"
        type="textarea"
        size="normal"
      />

      <span slot="footer" class="dialog-footer">
        <el-button @click="mostDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="adddeloption">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 新增题组弹框 -->
    <el-dialog
      title="新增题组"
      append-to-body
      center
      :visible.sync="question_varisible_item"
      width="40%"
      @close="quetionItemVisibleClose"
    >
      <el-form
        ref="twoRuleForm"
        :model="newAddForm"
        :rules="rules"
        label-width="100px"
      >
        <el-form-item label="题组名称" prop="name">
          <el-input v-model="newAddForm.name" style="width: 200px" />
        </el-form-item>
        <el-form-item label="描述">
          <el-input v-model="newAddForm.date1" style="width: 200px" />
        </el-form-item>
        <!-- 变量数组 -->
        <div
          v-for="(item, index) in newAddForm.varisibleItem"
          :key="index + 211"
          style="border-top: 1px solid rgba(187, 187, 187, 0.3)"
        >
          <div style="display: flex; align-items: center">
            <div
              style="
                width: 100px;
                padding-right: 12px;
                display: flex;
                justify-content: flex-end;
              "
            >
              <div
                style="
                  width: 17px;
                  height: 17px;
                  border-radius: 50%;
                  line-height: 15px;
                  text-align: center;
                  background: #ddd;
                "
                @click="minusVarisibleItem(index)"
              >
                -
              </div>
              <span
                style="
                  color: #606266;
                  font-size: 14px;
                  font-weight: 700;
                  margin-left: 5px;
                "
              >变量名称</span>
            </div>
            <el-form-item style="margin: 10px 0 17px 0" class="varisible-item" prop="two_name">
              <el-input v-model="item.name" style="width: 200px" />
            </el-form-item>
          </div>
          <el-form-item label="变量描述">
            <el-input v-model="item.varisibleDescrible" style="width: 200px" />
          </el-form-item>
          <el-form-item label="题目类型" :required="true">
            <el-radio-group v-model="item.resource">
              <el-radio label="1">单选</el-radio>
              <el-radio label="2">多选</el-radio>
              <el-radio label="3">下拉</el-radio>
              <el-radio label="4">附件上传</el-radio>
              <el-radio label="5">文本框</el-radio>
              <el-radio label="7">时间</el-radio>
            </el-radio-group>
          </el-form-item>
          <!-- 单选||多选 -->
          <div v-if="item.resource == 1 || item.resource == 2">
            <el-form-item label="选项" prop="three_valida_text" style="margin: 0;padding-bottom:10px;">
              <!-- 单个选项 -->
              <div
                v-for="(item1, index1) in item.questionDescribe"
                :key="index1 + 1214"
                style="margin-bottom: 5px"
              >
                <el-input v-model="item1.text" style="width: 200px" />
                <span
                  style="margin-left: 10px"
                  @click="minusQuetionSingleItem(index, index1)"
                >x</span>
              </div>
            </el-form-item>
            <el-form-item label="">
              <el-button
                type="text"
                size="default"
                @click="addSingleItem(3, index)"
              >+添加单个选项</el-button>
              <el-button
                type="text"
                size="default"
                @click="addSingleItem(4, index)"
              >+添加[其他]项</el-button>
            </el-form-item>
          </div>
          <div v-else-if="item.resource == 3">
            <el-form-item label="选项" prop="three_valida_text" style="margin: 0">
              <!-- 单个选项 -->
              <div
                v-for="(item1, index1) in item.questionDescribe"
                :key="index1 + 1214"
                style="margin-bottom: 5px"
              >
                <el-input v-model="item1.text" style="width: 200px" />
                <span
                  style="margin-left: 10px"
                  @click="minusQuetionSingleItem(index, index1)"
                >x</span>
              </div>
            </el-form-item>
            <el-form-item label="">
              <el-button
                type="text"
                size="default"
                @click="addSingleItem(3, index)"
              >+添加单个选项</el-button>
            </el-form-item>
          </div>
          <!-- 附件上传 -->
          <div v-else-if="item.resource == 4">
            <el-upload
              class="upload-demo"
              action="#"
              multiple
              :limit="3"
              disabled
            >
              <el-button
                size="small"
                type="primary"
                disabled
              >点击上传</el-button>
            </el-upload>
          </div>
          <!-- 文本 -->
          <div v-else-if="item.resource == 5">
            <el-form-item label="选项">
              <el-select v-model="item.textInputValue" placeholder="请选择">
                <el-option
                  v-for="item2 in options"
                  :key="item2.value"
                  :label="item2.label"
                  :value="item2.value"
                />
              </el-select>
            </el-form-item>
            <el-form-item label="">
              <el-input
                v-model="item.desc"
                disabled
                :type="item.textInputValue == 2 ? 'textarea' : ''"
                style="width: 200px"
              />
            </el-form-item>
          </div>

          <div v-else-if="item.resource == 7">
            <div class="block">
              <span class="demonstration" />
              <el-input v-model="demo_time" disabled prefix-icon="el-icon-time" size="normal" style="width:200px" />
            </div>
          </div>
        </div>
        <!-- 添加变量 -->
        <div
          class="addVisibleArray"
          style="
            width: 100px;
            padding-right: 12px;
            display: flex;
            justify-content: flex-end;
            align-items: center;
          "
          @click="addVisibleItemArr"
        >
          <img :src="addWB" alt="" width="18" height="18" srcset="">
          <el-button
            type="text"
            style="margin-left: 5px"
            size="default"
          >添加变量</el-button>
        </div>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="question_varisible_item = false">取 消</el-button>
        <el-button type="primary" @click="quetionItemConfirm">确定</el-button>
      </span>
    </el-dialog>
    <!-- 创建成功 -->
    <div class="create-success">
      <div class="childcreate-success">
        <!-- <div class="revocation" style="fontSize:16px">
          <span v-show="revocationIsshow" @click="revocationConfirm">
            撤销
          </span> </div> -->
        <div
          class="btnrevocation btnrevocations"
          style="  background-color: #fff;padding-right:10px"
          @click="establish"
        >
          <span class="btnpreserve" style="color:#000;cursor:pointer;fontSize:16px">
            <span style="marginRight:5px">保 存</span>
          </span>

        </div>
        <div
          class="btnrevocation"
          @click="AddingPassword"
        >
          <span class="btnpreserve" style="color:#fff;cursor:pointer;fontSize:16px">
            <span style="marginRight:5px">创建成功</span>
          </span>

        </div>
      </div>
    </div>
    <!-- 编辑变量弹框 -->
    <el-dialog
      title="编辑变量"
      append-to-body
      center
      :visible.sync="newaddVisible"
      width="40%"
      @close="newaddClose"
    >
      <el-form
        ref="newruleForm"
        :model="newruleForm"
        :rules="newrules"
        label-width="100px"
        class="demo-ruleForm"
        @close="newaddVisibleClose"
      >
        <el-form-item label="变量名称" prop="name">
          <el-input v-model="newruleForm.name" style="width: 200px" />
        </el-form-item>
        <el-form-item label="变量描述">
          <el-input v-model="newruleForm.date1" style="width: 200px" />
        </el-form-item>
        <el-form-item label="题目类型" prop="resource">
          <el-radio-group v-model="newruleForm.resource">
            <el-radio label="1">单选</el-radio>
            <el-radio label="2">多选</el-radio>
            <el-radio
              label="3"
              :disabled="newclickable === true"
            >下拉</el-radio>
            <el-radio
              label="4"
              :disabled="newclickable === true"
            >附件上传</el-radio>
            <el-radio
              :label="newruleForm.resource == '6' ? '6' : '5'"
              :disabled="newclickable === true"
            >文本框</el-radio>
            <el-radio
              label="7"
              :disabled="newclickable === true"
            >时间</el-radio>
          </el-radio-group>
        </el-form-item>
        <!-- 单选||多选 -->
        <div v-if="newruleForm.resource == 1 || newruleForm.resource == 2">
          <el-form-item label="选项" :required="true">
            <!-- 单个选项 -->
            <div
              v-for="(item, index) in newruleForm.questionDescribe"
              :key="index + 1214"
              style="margin-bottom: 5px"
            >
              <el-input v-model="item.option_name" style="width: 200px" />
              <span
                style="margin-left: 10px"
                @click="newminusSingleItem(item, index)"
              >x</span>
              <span
                v-if="index == 0"
                style="margin-left: 70px; color: red"
                @click="newbatch"
              >批量操作</span>
            </div>
          </el-form-item>
          <el-form-item label="">
            <el-button
              type="text"
              size="default"
              @click="newaddSingleItem(1)"
            >+添加单个选项</el-button>
            <el-button
              type="text"
              size="default"
              @click="newaddSingleItem(2)"
            >+添加[其他]项</el-button>
          </el-form-item>
        </div>
        <div v-else-if="newruleForm.resource == 3">
          <el-form-item label="选项" :required="true">
            <!-- 单个选项 -->
            <div
              v-for="(item, index) in newruleForm.questionDescribe"
              :key="index + 1214"
              style="margin-bottom: 5px"
            >
              <el-input v-model="item.option_name" style="width: 200px" />
              <span
                style="margin-left: 10px"
                @click="newminusSingleItem(item, index)"
              >x</span>
            </div>
          </el-form-item>
          <el-form-item label="">
            <el-button
              type="text"
              size="default"
              @click="newaddSingleItem(1)"
            >+添加单个选项</el-button>
          </el-form-item>
        </div>
        <!-- 附件上传 -->
        <div v-else-if="newruleForm.resource == 4">
          <el-upload
            class="upload-demo"
            action="#"
            multiple
            :limit="3"
            disabled
          >
            <el-button size="small" type="primary" disabled>点击上传</el-button>
          </el-upload>
        </div>
        <!-- 文本 -->
        <div v-else-if="newruleForm.resource == 5|newruleForm.resource == 6">
          <el-form-item label="选项">
            <!-- <el-input v-model="ruleForm.desc" style="width:200px;" /> -->
            <el-select v-model="newruleForm.resource" placeholder="请选择">
              <el-option
                v-for="item in firrstnewoptions"
                :key="item.value"
                :label="item.label"
                :value="item.value"
              />
            </el-select>
          </el-form-item>
          <el-form-item label="">
            <el-input
              v-model="newruleForm.desc"
              disabled
              :type="newruleForm.resource == 6 ? 'textarea' : ''"
              style="width: 200px"
            />
          </el-form-item>
        </div>
        <div v-else-if="newruleForm.resource == 7">
          <div class="block">
            <span class="demonstration" />
            <el-input v-model="demo_time" disabled prefix-icon="el-icon-time" size="normal" style="width:200px" />
          </div>
        </div>
      </el-form>

      <span slot="footer" class="dialog-footer">
        <el-button @click="EditVariableCancel">取消</el-button>
        <el-button type="primary" @click="EditVariableConfirm">确定</el-button>
      </span>
    </el-dialog>
    <!-- 编辑变量组弹框  -->
    <el-dialog
      title="编辑变量"
      :visible.sync="itemVisible"
      append-to-body
      center
      width="30%"
      @close="itemVisiableClose"
    >
      <el-form ref="itemForm" v-model="itemForm" :inline="false" size="normal">
        <el-form-item label="变量名称">
          <el-input v-model="itemForm.name" style="width: 200px" />
        </el-form-item>
        <el-form-item label="变量描述">
          <el-input v-model="itemForm.desc" style="width: 200px" />
        </el-form-item>
      </el-form>
      <span slot="footer" class="dialog-footer">
        <el-button @click="itemVisible = false">取 消</el-button>
        <el-button type="primary" @click="itemVisible = false">确 定</el-button>
      </span>
    </el-dialog>
    <!-- 批量修改弹框 -->
    <el-dialog
      title="批量修改选项"
      center
      append-to-body
      :visible.sync="newmostDialogVisible"
      width="30%"
      @close="newmostColse"
    >
      <span>每一行代表一个选项，可以添加多个选项</span>
      <el-input
        v-model="newmostData"
        placeholder="请输入内容"
        type="textarea"
        size="normal"
      />

      <span slot="footer" class="dialog-footer">
        <el-button @click="newmostDialogVisible = false">取 消</el-button>
        <el-button type="primary" @click="twoadddeloption">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="修改变量组名称"
      center
      append-to-body
      :visible.sync="newmostDialogVisibles"
      width="30%"
    >
      <div>变量组:</div>
      <br>
      <el-input
        v-model="newmostDataList"
        placeholder="请输入内容"
        type="text"
        size="normal"
      />
      <br>
      <br>
      <div>变量描述:</div>
      <br>
      <!-- 变量描述 -->
      <el-input
        v-model="paramString"
        placeholder="请输入描述内容"
        type="text"
        size="normal"
      />

      <span slot="footer" class="dialog-footer">
        <el-button @click="newmostDialogVisibles = false">取 消</el-button>
        <el-button type="primary" @click="twoadddeloptions">确 定</el-button>
      </span>
    </el-dialog>
    <el-dialog
      title="提示"
      :visible.sync="set_bianji_pattern"
      append-to-body
      width="30%"
      style="margin-top: 150px"
    >
      <span>是否保存已录入数据？</span>
      <span slot="footer" class="dialog-footer">
        <el-button @click="set_bianji_pattern = false">取 消</el-button>
        <el-button @click="set_pattern_data">不 保 存</el-button>
        <el-button type="primary" @click="baocun_data">保 存</el-button>
      </span>
    </el-dialog>
  </div>

</template>

<script>
// 引入拖拽
import vuedraggable from 'vuedraggable'
import {
  getTemplateSecondItem, // 获取模板二级模块
  setTemplateItemAdnQuestion, // 设置模板-含新增/编辑/删除/排序-目录/模块/变量
  getInfoBySecondItemId // 根据二级模块获取相关信息
} from '@/api/stencil'
export default {
  components: {
    vuedraggable
  },
  props: {
    directoryList: { type: Array, default: () => [] }, // 这里就是用户点击目录传递过来的数据
    fullscreenLoading: { type: Boolean, default: false }, // loading
    // fixedmodules: { type: Number, default: 0 },
    SubmitToSave: { type: Number, default: 0 },
    changeDirectorydoNot: { type: Number, default: 0 } // 通过该数据来清理newDataList的数据
  },
  data() {
    // 自定义表单验证
    var valida_text = (rule, value, callback) => {
      let is_pass = true
      this.ruleForm.questionDescribe.forEach(item => {
        if (item.text === '') {
          is_pass = false
        }
      })
      if (is_pass) {
        callback()
      } else {
        callback(new Error('内容不能为空'))
      }
    }
    var two_valida_text = (rule, value, callback) => {
      let is_pass = true
      this.newAddForm.varisibleItem.forEach(item => {
        if (item.name === '') {
          is_pass = false
        }
      })
      if (is_pass) {
        callback()
      } else {
        // callback(new Error('内容不能为空'))
      }
    }
    var three_valida_text = (rule, value, callback) => {
      let is_pass = true
      this.newAddForm.varisibleItem.forEach(item => {
        item.questionDescribe.forEach(item2 => {
          if (item2.text === '') {
            is_pass = false
          }
        })
      })
      if (is_pass) {
        callback()
      } else {
        // callback(new Error('内容不能为空'))
      }
    }
    return {
      newDataList: [], // 定义数据
      newDataListFalse: false, // 判断是否使用
      set_bianji_pattern: false, // 提示用户是否保存数据
      revocationIsshow: false, // 撤销是否显示
      select_module_id: '', // 选中模块id
      select_variable: '', // 选中变量id
      newfilesterlist: '', // 防止默认选中
      module_logo_bule: require('@/assets/images/png/module_logo_bule.png'),
      module_logo: require('@/assets/images/png/module_logo.png'),
      variable_logo: require('@/assets/images/png/variable__logo.png'),
      module_move_arr: [], // 假数据，用于模块拖动
      cur_module_arr: [], // 一级模块数组
      reBlockForm: { // 自定义模块数据
        name: '',
        block_select: '',
        new_block_select: ''
      },
      block_rules: { // 自定义模块验证规则
        name: [
          { required: true, message: '内容不能为空', trigger: 'blur' }
        ],
        block_select: [
          { required: true, message: '内容不能为空', trigger: 'change' }
        ]
      },
      demo_time: 'yy-mm-dd',
      is_group: false, // 控制子跟父元素不能拖拽
      newsisGroup: false, // 控制用户是否拖动变量组
      newVariable: false, // 用户新增变量组时候改变的
      newAddBlockForm: { name: '' },
      new_add_id: Number, // 模块/变量id
      block_varible: false, // 新增模塊/變量
      itemVisible: false, // 变量组弹框显示
      itemForm: {
        name: '',
        desc: ''
      }, // // 变量组弹框数据
      // activeName: 'second',
      addWB: require('@/assets/images/png/addWB.png'),
      addVisible: false, // 添加变量弹框
      question_varisible_item: false, // 题组弹框
      is_slect_item: false, // 模块和变量
      items: [
        {
          question_name: '变量组',
          question_type: 0,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '单选',
          question_type: 1,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '多选',
          question_type: 2,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '下拉',
          question_type: 3,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '附件上传',
          question_type: 4,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '单行文本',
          question_type: 5,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '多行文本',
          question_type: 6,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '时间(y-m-d)',
          question_type: 7,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        }
      ], // 这里就是选项
      second_items_add: [], // 模块
      drag: false,
      basicTemplateId: '', // basicTemplateId
      // database_id: '', // 数据库id
      // template_id: '', // 模板id
      // 添加变量弹框数据
      ruleForm: {
        name: '', // 名字
        date1: '', // 变量描述
        date2: '',
        resource: '1', // 选项类型
        desc: '',
        questionDescribe: [{ text: '' }]
      },
      rules: {
        name: [
          { required: true, message: '请输入变量名称', trigger: 'blur' },
          {
            min: 1,
            max: 15,
            message: '长度在 1 到 15 个字符',
            trigger: 'blur'
          }
        ],
        two_name: [
          { validator: two_valida_text, trigger: 'blur' }
        ],
        three_valida_text: [
          { validator: three_valida_text, trigger: 'blur' }
        ],
        text: [
          { validator: valida_text, trigger: 'blur' }
        ],
        date1: [
          {
            type: 'date',
            required: true,
            message: '请选择日期',
            trigger: 'change'
          }
        ],
        date2: [
          {
            type: 'date',
            required: true,
            message: '请选择时间',
            trigger: 'change'
          }
        ],
        resource: [
          { required: true, message: '请选择题目类型', trigger: 'blur' }
        ]
      },
      // 文本类型
      options: [
        {
          value: '1',
          label: '单行文本框'
        },
        {
          value: '2',
          label: '多行文本框'
        }
      ],
      textInputValue: '1',
      newMenus: [], // 用来存放用户拖拽完成之后的一级目录的数据
      singleCount: [1],
      doubleCount: [],
      mostDialogVisible: false, // 批量弹框
      mostData: '', // 批量数据
      // 新增题组数据
      newAddForm: {
        name: '', // 名字
        date1: '', // 变量描述
        // 变量数组
        varisibleItem: [
          {
            name: '', // 名字
            varisibleDescrible: '', // 变量描述
            resource: '1', // 选项类型
            questionDescribe: [{ text: '' }],
            textInputValue: '1',
            desc: ''
          }
        ]
      },
      // 假数据显示
      resoptions: [{
        value: '选项1',
        label: '黄金糕'
      }, {
        value: '选项2',
        label: '双皮奶'
      }, {
        value: '选项3',
        label: '蚵仔煎'
      }, {
        value: '选项4',
        label: '龙须面'
      }, {
        value: '选项5',
        label: '北京烤鸭'
      }],
      resvalue: '',
      newmostData: '', // 批量弹框数据
      newmostDialogVisible: false, // 批量弹框显示
      newaddVisible: false, // 编辑弹框显示
      newtextInputValue: '1',
      firrstnewoptions: [{
        value: '5',
        label: '单行文本'
      }, {
        value: '6',
        label: '多行文本'
      }], // 编辑变量弹框  控制单双文本框数据
      // 编辑变量弹框数据
      newruleForm: {
        name: '', // 名字
        date1: '', // 变量描述
        date2: '',
        resource: '1', // 选项类型
        desc: '',
        questionDescribe: [{ option_name: '' }]
      },
      newrules: {
        name: [
          { required: true, message: '请输入变量名称', trigger: 'blur' },
          {
            min: 1,
            max: 15,
            message: '长度在 1 到 15 个字符',
            trigger: 'blur'
          }
        ],
        date1: [
          {
            type: 'date',
            required: true,
            message: '请选择日期',
            trigger: 'change'
          }
        ],
        date2: [
          {
            type: 'date',
            required: true,
            message: '请选择时间',
            trigger: 'change'
          }
        ],
        resource: [
          { required: true, message: '请选择题目类型', trigger: 'blur' }
        ]
      },
      // 文本类型
      firstNewOptions: [
        {
          value: '1',
          label: '单行文本框'
        },
        {
          value: '2',
          label: '多行文本框'
        }
      ],
      // 用户编辑时候的数据
      levelOneVariable: [], // 一级变量
      amendOptions: [], // 修改选项
      optionRedact: [], // 这里就是用户点击编辑时候的原选项内容
      newquestionDescribe: [],
      newclickable: false, // 这里就是用户点击编辑之后将值改为true 就变为不可点击
      // modified: '', // 用户刷新浏览器给的操作   this.$store.dispatch('management/setSetmodified', false)
      // NoStarting: true, // 只要用户点击添加模块就禁止此数据
      AddSecondary: false, // 新增二级变量
      newSites: true, // 拖拽名称
      is_up_weight: false, // 是否更新权重 默认为false不更新 如果当用户进行拖拽排序就需要改为true
      firstMenus: [], // 修改的数据
      dataConfirmation: false, // 修改数据确定
      /* 编辑变量组弹框 */
      newmostDialogVisibles: false, // 显示/隐藏
      newmostDataList: '', // 回显的内容
      paramString: '', // 回显的描述
      assignmentList: {}, // 需要暂时赋值 twoadddeloptions
      variableGroupxxx: {}, // 户点击编辑变量组内选项
      newssecondSite: 'second-site', // 目录显示
      newSiteList: 'site', // 变量显示
      saveSuccessfully: false // 保存成功在调用
    }
  },
  computed: {
    // 数据库id
    database_id() {
      return this.IsItOperable === 0 ? 0 : this.$store.state.database.database_id
    },
    /* 模板id */
    template_id() {
      return this.IsItOperable === 0 ? this.$store.state.user.userInfo.basicTemplateId : this.$store.state.database.template_id
    },
    // 是否新增数据
    IsItOperable() {
      return this.$store.state.database.IsItOperable
    },
    // 用户刷新浏览器给的操作   this.$store.dispatch('management/setSetmodified', false)
    modified() {
      return this.$store.state.management.modified
    }
  },
  watch: {
    // fixedmodules: {
    //   handler(value) {
    //     if (document.getElementById('mains')) {
    //       console.log('fixedmodules变化了！！！', document.getElementById('mains').scrollTop, window.scrollTop)
    //       // document.getElementById('mains').scrollIntoView()
    //     }
    //   }
    // },
    fullscreenLoading: {
      handler(value) {
        console.log(this.fullscreenLoading, value, 'loading被触发拉！！！')
        let loading
        if (!loading) {
          loading = this.$loading({
            lock: true,
            text: '加载中...',
            spinner: 'el-icon-loading',
            background: 'rgba(253, 253, 253, 0.9)'
          })
        }

        if (!value) {
          loading.close()
        }
      }
    },
    SubmitToSave: {
      handler(value) {
        console.log(this.SubmitToSave, value, 'this.SubmitToSave')
        if (value === 1) {
          // this.SubmitToSave = 0
          this.establish()
        }
      }
    },
    directoryList: {
      handler(value) {
        if (this.newDataListFalse) {
          console.log('赋值前', this.newDataList)
          this.directoryList = this.newDataList
        }
        console.log('this.directoryList被修改', this.directoryList, this.newDataList)
      }
    },
    changeDirectorydoNot: {
      handler() {
        console.log('我被触发了', this.changeDirectorydoNot)
        if (this.changeDirectorydoNot === 1) {
          this.newDataListFalse = false
          this.newDataList = []
        }
      }
    }

  },
  mounted() {
    window.onbeforeunload = e => {
      if (!this.modified) {
        return
      }
      // 通知浏览器不要执行与事件关联的默认动作
      e.preventDefault()
      // Chrome 需要 returnValue 被设置成空字符串
      e.returnValue = ''
      // 如果用户刷新就清空数据
      console.log('清空数据')
      // this.$store.dispatch('management/setModuleSelected', [])
      // // 清空删除数据
      // this.$store.dispatch('management/setDeleteMessages', [])
      // // 清空删除目录信息
      // this.$store.dispatch('management/setDeletCatalogue', [])
      // this.$store.dispatch('management/setSetmodified', false)
    }
  },
  created() {
    this.basicTemplateId = this.$store.state.user.userInfo.basicTemplateId
    this.database_id = this.$store.getters.database_id
    this.template_id = this.$store.getters.template_id
    console.log(
      ' this.$store.getters.template_id',
      this.$store.getters.template_id
    )
    this.newSecondItem()
    this.$store.dispatch('management/setModuleSelected', [])
    // 清空删除数据
    this.$store.dispatch('management/setDeleteMessages', [])
    // 清空删除目录信息
    this.$store.dispatch('management/setDeletCatalogue', [])
  },
  methods: {
    // 创建成功
    async  AddingPassword() {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      // 首先调用保存
      await this.establish()
      // 然后成功了在跳转到首页、
      if (this.saveSuccessfully) {
        this.$store.dispatch('management/removemanagement')
        this.fullscreenLoading = false
        const z = setTimeout(() => {
          this.$router.push({ name: 'Dashboard' })
          clearTimeout(z)
        }, 1)

        // this.fullscreenLoading = true
      }
    },
    // 点击保存
    baocun_data() {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      console.log('点击保存')
      this.establish()
      this.set_bianji_pattern = false
      this.revocationIsshow = false
    },
    // 点击不保存
    set_pattern_data() {
      if (this.newDataListFalse) {
        console.log('进来了！')
        this.newDataList = []
        // this.directoryList = []
        this.newDataListFalse = false
      }
      // console.log('点击不保存')
      // 点击不保存清空数据
      this.$store.dispatch('management/setModuleSelected', [])
      // 清空删除数据
      this.$store.dispatch('management/setDeleteMessages', [])
      // 清空删除目录信息
      this.$store.dispatch('management/setDeletCatalogue', [])
      this.modified = false
      this.$emit('ClickTriggered')
      this.set_bianji_pattern = false
      this.revocationIsshow = false
      this.$forceUpdate()
    },
    // 撤销数据
    revocationConfirm() {
      this.set_bianji_pattern = true
    },
    // 获取模块选中id
    selectModuleId(item_id) {
      this.select_module_id = item_id
    },
    // 获取变量选中id
    selectVariableId(item) {
      item.is_select = !item.is_select
      this.items.forEach(item2 => {
        if (item2.question_name !== item.question_name) {
          item2.is_select = false
        }
      })
    },
    // 删除模块
    deletedModels(e) {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      console.log('eeeeee', e, this.directoryList)
      // 删除一级模块
      // 判断之前是否有目录或者模块id
      if (e.item_id === 0) {
        // 等于0不用管
      } else {
        if (this.$store.state.management.deletCatalogue.length >= 1) {
          const z = this.$store.state.management.deletCatalogue
          console.log('[...z, e.item_id]', [...z, e.item_id])
          this.$store.dispatch('management/setDeletCatalogue', [...z, e.item_id])
        } else {
          this.$store.dispatch('management/setDeletCatalogue', [e.item_id])
        }
      }
      this.directoryList.forEach((directoryList, index) => {
        if (directoryList.item_id === e.item_id) {
          this.directoryList.splice(index, 1)
        }
      })
      // 页面渲染
      console.log(this.$store.state.management.deletCatalogue)
    },
    // 数据的显示隐藏
    incalids(e) {
      console.log('eee', e)
      e.invalid_parameter = !e.invalid_parameter
      this.$forceUpdate()
    },
    sort(e) {
      console.log('position change', e)
    },
    onStartMove(e) {
      // console.log('move begin', e)
    },
    // 添加新增自定义函数
    async onEndsMove(e) {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      console.log('this.directoryList', this.directoryList)
      const cur_position = e.to.__vue__.$attrs.animation
      this.reBlockForm.block_select = cur_position.toString()
      await this.newAddBlock(0)
      this.block_varible = true
    },
    // 清除新增模块验证和数据
    blockClose() {
      this.reBlockForm = {
        name: '',
        block_select: '',
        new_block_select: ''
      }
      this.$refs.reBlockForm.resetFields()
    },
    // 新增模块确定
    newAddBlockConfirm() {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      let pass = true
      if (this.new_add_id === 0) { // 新增模块
        console.log('模块', this.reBlockForm)
        // 表单验证
        this.$refs.reBlockForm.validate((value) => {
          if (value) {
            pass = true
          } else {
            pass = false
          }
        })
        if (!pass) {
          return false
        }
        const data = {
          item_id: 0,
          item_name: this.reBlockForm.name,
          parent_id: 0,
          question_answer_list: [''],
          question_lists: [],
          relation_id: 0,
          show_status: 1,
          xxx: 'heiheihei'
        }
        const data2 = {
          item_id: 0,
          item_name: this.reBlockForm.new_block_select,
          parent_id: 0,
          relation_id: 0,
          second_item: [data],
          xxx: 'heiheihei'
        }
        if ((this.cur_module_arr.length + 1).toString() !== this.reBlockForm.block_select) { // 有一级目录
          this.directoryList[this.reBlockForm.block_select].second_item.push(data)
        } else { // 没有一级目录
          if (this.reBlockForm.new_block_select === '') {
            this.$message.error('新增组不能为空')
            return false
          } else {
            this.directoryList.push(data2)
          }
        }
        // 提交数据
        // this.establish()
      } else { // 新增变量
        const data =
        {
          question_name: this.newAddBlockForm.name,
          question_type: 0,
          question_id: 0,
          show_status: 1,
          relation_id: 0
        }
        console.log('变量')
        this.items.push(data)
      }
      this.block_varible = false
      // 操作数据显示撤销
      this.revocationIsshow = true
      this.$store.dispatch('management/setSetmodified', true)
    },
    // 新增模块和变量
    newAddBlock(id) {
      this.block_varible = true
      this.new_add_id = id
      // 没有一级模块
      if (this.directoryList.toString() === '') {
        console.log('nodata')
        this.reBlockForm.block_select = '1'
        this.cur_module_arr = []
        return
      }
      if (id === 0) {
        this.cur_module_arr = this.directoryList.map(item => {
          return { item_name: item.item_name }
        })
        console.log(this.cur_module_arr)
      }
    },
    // 重置变量组弹框数据
    itemVisiableClose() {
      this.itemForm = {
        name: '',
        desc: ''
      }
    },
    // 获取用户的一二级目录
    obtainDirectory() {
      this.newMenus = []
      const listManagement = this.$store.state.management.listManagement
      // 然后获取id
      const managementitem_id = this.$store.state.management.managementitem_id
      // 然后循环listManagement
      listManagement.forEach((management) => {
        // 判断是否有items
        // 如果有 那么说明目录有二级目录
        // 需要循环二级目录
        if (management.items.length >= 1) {
          management.items.forEach((items) => {
            // 判断items的item_id是否等于managementitem_id 如果等于说明等于的就是用户选中的目录
            if (items.item_id === managementitem_id) {
              // 如果等于了需要拿到一级目录加上自身
              console.log('二级目录等于了', management, items)
              // 将目录的数据存起来
              this.firstMenus = this.newMenus = [
                {
                  item_name: management.item_name,
                  item_id: management.item_id,
                  relation_id: management.relation_id,
                  show_status: management.status,
                  is_up_weight: false,
                  dir_data: [
                    {
                      item_name: items.item_name,
                      item_id: items.item_id,
                      relation_id: items.relation_id,
                      show_status: items.status,
                      is_select: items.item_id === 0 ? 1 : 0,
                      is_up_weight: true
                    }
                  ]
                }
              ]
            }
          })
        } else {
          // 如果不等于 说明该一级目录没有二级目录 需要判断自身
          if (management.item_id === managementitem_id) {
            // 如果等于说明该一级目录就是用户选中的目录
            console.log('用户选中的一级目录', management)
            this.firstMenus = this.newMenus = [
              {
                item_name: management.item_name,
                item_id: management.item_id,
                relation_id: management.relation_id,
                show_status: management.status,
                is_select: management.item_id === 0 ? 1 : 0,
                dir_data: ''
              }
            ]
          }
        }
      })
      // this.firstMenus = this.newMenus
      // JSON.stringify(JSON.parse(this.newMenus))
      console.log('一二级目录', this.firstMenus)
    },
    // 用户编辑时候调用批量操作
    newbatch() {
      if (this.newruleForm.questionDescribe[0].option_name !== '') {
        var mostData = ''
        this.newruleForm.questionDescribe.forEach((e) => {
          mostData += e.option_name + '\n'
        })
        this.newmostData = mostData
      }
      console.log('点击批量操作', this.newmostData)
      this.newmostDialogVisible = true
    },
    // 编辑时候点击确定
    twoadddeloption() {
      // newruleForm.questionDescribe
      if (this.newmostData.split('\n')) {
        const ListArry = this.newmostData.split('\n')
        // questionDescribe = []
        this.newruleForm.questionDescribe = []
        ListArry.forEach((item) => {
          if (item.replace(/\s/gi, '')) {
            this.newruleForm.questionDescribe.push({ option_name: item.replace(/\s/gi, '') })
          }
        })
      } else {
        this.newruleForm.questionDescribe.push({ option_name: this.newmostData })
      }
      // 关闭弹窗
      this.newmostDialogVisible = false
      console.log(this.newruleForm.questionDescribe)
    },
    // 用户添加的时候拿的数据
    batch() {
      if (this.ruleForm.questionDescribe[0].text !== '') {
        var mostData = ''
        this.ruleForm.questionDescribe.forEach((e) => {
          mostData += e.text + '\n'
        })
        this.mostData = mostData
      }
      console.log('点击批量操作', this.mostData)
      this.mostDialogVisible = true
    },
    // 点击确定批量修改
    adddeloption() {
      console.log('点击确定批量修改', this.mostData)
      if (this.mostData.split('\n')) {
        const ListArry = this.mostData.split('\n')
        // questionDescribe = []
        this.ruleForm.questionDescribe = []
        ListArry.forEach((item) => {
          if (item.replace(/\s/gi, '')) {
            this.ruleForm.questionDescribe.push({ text: item.replace(/\s/gi, '') })
          }
        })
      } else {
        this.ruleForm.questionDescribe.push({ text: this.mostData })
      }
      this.mostDialogVisible = false
      // console.log('this.ruleForm.questionDescribe', this.ruleForm.questionDescribe)
    },
    // 移除常用变量
    removeUsualVariable() {
      this.$confirm('是否将该模块移出常用变量？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        this.$message.success('移出成功')
      }).catch(() => {
        this.$message.info('已取消移出')
      })
    },
    // 点击创建
    async  establish() {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      this.saveSuccessfully = false
      this.fullscreenLoading = true
      this.obtainDirectory()
      this.modified = false
      this.revocationIsshow = false
      this.$store.dispatch('management/setSetmodified', false)
      console.log('点击被触发', typeof this.directoryList)
      // 获取需要删除的目录
      const item_arr = this.$store.state.management.deletCatalogue.length === 0 ? '' : this.$store.state.management.deletCatalogue
      // 获取需要删除的内容
      const delArr = this.$store.state.management.deleteMessages.length === 0 ? '' : this.$store.state.management.deleteMessages
      const NEWdel = {
        item_arr: item_arr,
        question_arr: delArr
      }
      let newdelarrs = '0'
      if (NEWdel.item_arr === '' && NEWdel.question_arr === '') {
        console.log('进来了')
        newdelarrs = '1'
      }

      const firesitemData = [] // 一级
      const twoitemData = [] // 二级
      // const firsttwoitemDate  = []
      const threeItem = [] // 一级变量
      const modelSelection = []
      console.log('组合数据', this.directoryList, this.firstMenus)

      // console.log('zzzzzzzzzz', z)
      // const z = JSON.parse(JSON.stringify(this.directoryList))
      //  let whetherisof = Object.prototype.hasOwnProperty.call(this.directoryList[0], 'item_id')
      if (this.directoryList.length >= 1) {
        this.directoryList.forEach((directoryList, one) => {
        // firesitemData[one] = {}
          twoitemData[one] = []
          directoryList.second_item.forEach((second_item, two) => {
            let z = {}
            threeItem[two] = []
            if (second_item.xxx) {
              if (second_item.question_lists) {
                second_item.question_lists.forEach((questionLists, three) => {
                  let threes = {}
                  const dimensionless = [] // 变量组里的
                  const newsOptions = [] // 变量组里的选项
                  if (questionLists.child_question) {
                  // 进来这里就是变量组
                  // dimensionless
                    dimensionless[three] = []
                    questionLists.child_question.forEach((child_question, a) => {
                      let newdimension = {}
                      if (child_question.option_list) {
                        child_question.option_list.forEach((option_list, b) => {
                          newsOptions[b] = {
                            option_id: 0,
                            option_name: option_list.option_name,
                            is_other: option_list.is_other
                          }
                        })
                      }
                      newdimension = {
                        question_name: child_question.question_name,
                        question_id: 0,
                        relation_id: 0,
                        show_status: child_question.show_status,
                        question_describe: child_question.question_describe ? child_question.question_describe : '',
                        question_type: child_question.question_type,
                        option_list: newsOptions.length === 0 ? '' : newsOptions
                      }
                      dimensionless[three].push(newdimension)
                    })
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: 0,
                      relation_id: 0,
                      question_type: questionLists.question_type,
                      question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                      show_status: questionLists.show_status,
                      child_question: dimensionless[three] === [] ? '' : dimensionless[three]
                    }
                    threeItem[two].push(threes)
                  } else {
                    if (questionLists.option_list) {
                      modelSelection[three] = []
                      questionLists.option_list.forEach((option_list, i) => {
                        let newselection = {}
                        newselection = {
                          option_id: 0,
                          option_name: option_list.option_name,
                          is_other: option_list.is_other
                        }
                        modelSelection[three].push(newselection)
                      })
                    } else {
                    //
                    }
                    // // 这里就是普通变量
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: 0,
                      relation_id: 0,
                      show_status: questionLists.show_status,
                      question_type: questionLists.question_type,
                      option_list: modelSelection === undefined ? '' : modelSelection[three]
                    }
                    threeItem[two].push(threes)
                  }
                })
              } else {
              // 这里就是没有变量的
              }
            } else {
              if (second_item.question_lists) {
                second_item.question_lists.forEach((questionLists, three) => {
                  let threes = {}
                  const dimensionless = [] // 变量组里的
                  const newsOptions = [] // 变量组里的选项
                  if (questionLists.question_type === 0) {
                    if (questionLists.child_question) {
                      // 进来这里就是变量组
                      // dimensionless
                      dimensionless[three] = []
                      questionLists.child_question.forEach((child_question, a) => {
                        let newdimension = {}
                        newsOptions[a] = []
                        if (child_question.option_list && child_question.option_list !== '') {
                          console.log('这里？', child_question)
                          child_question.option_list.forEach((option_list, b) => {
                            let resnewsOptions = {}
                            resnewsOptions = {
                              option_id: option_list.option_id,
                              option_name: option_list.option_name,
                              is_other: option_list.is_other
                            }
                            newsOptions[a].push(resnewsOptions)
                          })
                        }
                        newdimension = {
                          question_name: child_question.question_name,
                          question_id: child_question.question_id,
                          relation_id: child_question.relation_id,
                          show_status: child_question.show_status,
                          question_describe: child_question.question_describe ? child_question.question_describe : '',
                          question_type: child_question.question_type,
                          option_list: newsOptions.length === 0 ? '' : newsOptions[a]
                        }
                        dimensionless[three].push(newdimension)
                      })
                      threes = {
                        question_name: questionLists.question_name,
                        question_id: questionLists.question_id,
                        relation_id: questionLists.relation_id,
                        show_status: questionLists.show_status,
                        question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                        question_type: questionLists.question_type,
                        child_question: dimensionless[three] === [] ? '' : dimensionless[three]
                      }
                      threeItem[two].push(threes)
                    } else {
                      threeItem[two] = []
                    }
                  } else {
                    if (questionLists.option_list) {
                      modelSelection[three] = []
                      questionLists.option_list.forEach((option_list, i) => {
                        let newselection = {}
                        newselection = {
                          option_id: option_list.option_id,
                          option_name: option_list.option_name,
                          is_other: option_list.is_other
                        }
                        modelSelection[three].push(newselection)
                      })
                    } else {
                    //
                      modelSelection[three] = []
                    }
                    // // 这里就是普通变量
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: questionLists.question_id,
                      relation_id: questionLists.relation_id,
                      show_status: questionLists.show_status,
                      question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                      question_type: questionLists.question_type,
                      option_list: modelSelection.length === 0 ? '' : modelSelection[three]
                    }
                    threeItem[two].push(threes)
                  }
                })
              } else {
              // 这里就是没有变量的
              }
              console.log('threeItem', threeItem)
            }
            z = {
              item_name: second_item.item_name,
              item_id: second_item.xxx ? '0' : second_item.item_id,
              relation_id: second_item.xxx ? '0' : second_item.relation_id,
              show_status: second_item.show_status,
              // is_up_weight: true,
              // 二级模块
              question_data: threeItem[two]
            }
            twoitemData[one].push(z)
          })
          firesitemData[one] = {
            item_name: directoryList.item_name,
            item_id: directoryList.item_id,
            relation_id: directoryList.relation_id,
            show_status: directoryList.show_status,
            // is_up_weight: false,
            // 二级模块
            item_data: twoitemData[one]
          }
        })
      }
      if (this.newDataListFalse) {
        this.newDataListFalse = false
        this.newDataList.forEach((directoryList, one) => {
        // firesitemData[one] = {}
          twoitemData[one] = []
          directoryList.second_item.forEach((second_item, two) => {
            let z = {}
            threeItem[two] = []
            if (second_item.xxx) {
              if (second_item.question_lists) {
                second_item.question_lists.forEach((questionLists, three) => {
                  let threes = {}
                  const dimensionless = [] // 变量组里的
                  const newsOptions = [] // 变量组里的选项
                  if (questionLists.child_question) {
                  // 进来这里就是变量组
                  // dimensionless
                    dimensionless[three] = []
                    questionLists.child_question.forEach((child_question, a) => {
                      let newdimension = {}
                      if (child_question.option_list) {
                        child_question.option_list.forEach((option_list, b) => {
                          newsOptions[b] = {
                            option_id: 0,
                            option_name: option_list.option_name,
                            is_other: option_list.is_other
                          }
                        })
                      }
                      newdimension = {
                        question_name: child_question.question_name,
                        question_id: 0,
                        relation_id: 0,
                        show_status: child_question.show_status,
                        question_describe: child_question.question_describe ? child_question.question_describe : '',
                        question_type: child_question.question_type,
                        option_list: newsOptions.length === 0 ? '' : newsOptions
                      }
                      dimensionless[three].push(newdimension)
                    })
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: 0,
                      relation_id: 0,
                      question_type: questionLists.question_type,
                      question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                      show_status: questionLists.show_status,
                      child_question: dimensionless[three] === [] ? '' : dimensionless[three]
                    }
                    threeItem[two].push(threes)
                  } else {
                    if (questionLists.option_list) {
                      modelSelection[three] = []
                      questionLists.option_list.forEach((option_list, i) => {
                        let newselection = {}
                        newselection = {
                          option_id: 0,
                          option_name: option_list.option_name,
                          is_other: option_list.is_other
                        }
                        modelSelection[three].push(newselection)
                      })
                    } else {
                    //
                    }
                    // // 这里就是普通变量
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: 0,
                      relation_id: 0,
                      show_status: questionLists.show_status,
                      question_type: questionLists.question_type,
                      option_list: modelSelection === undefined ? '' : modelSelection[three]
                    }
                    threeItem[two].push(threes)
                  }
                })
              } else {
              // 这里就是没有变量的
              }
            } else {
              if (second_item.question_lists) {
                second_item.question_lists.forEach((questionLists, three) => {
                  let threes = {}
                  const dimensionless = [] // 变量组里的
                  const newsOptions = [] // 变量组里的选项
                  if (questionLists.question_type === 0) {
                    if (questionLists.child_question) {
                      // 进来这里就是变量组
                      // dimensionless
                      dimensionless[three] = []
                      questionLists.child_question.forEach((child_question, a) => {
                        let newdimension = {}
                        newsOptions[a] = []
                        if (child_question.option_list && child_question.option_list !== '') {
                          console.log('这里？', child_question)
                          child_question.option_list.forEach((option_list, b) => {
                            let resnewsOptions = {}
                            resnewsOptions = {
                              option_id: option_list.option_id,
                              option_name: option_list.option_name,
                              is_other: option_list.is_other
                            }
                            newsOptions[a].push(resnewsOptions)
                          })
                        }
                        newdimension = {
                          question_name: child_question.question_name,
                          question_id: child_question.question_id,
                          relation_id: child_question.relation_id,
                          show_status: child_question.show_status,
                          question_describe: child_question.question_describe ? child_question.question_describe : '',
                          question_type: child_question.question_type,
                          option_list: newsOptions.length === 0 ? '' : newsOptions[a]
                        }
                        dimensionless[three].push(newdimension)
                      })
                      threes = {
                        question_name: questionLists.question_name,
                        question_id: questionLists.question_id,
                        relation_id: questionLists.relation_id,
                        show_status: questionLists.show_status,
                        question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                        question_type: questionLists.question_type,
                        child_question: dimensionless[three] === [] ? '' : dimensionless[three]
                      }
                      threeItem[two].push(threes)
                    } else {
                      threeItem[two] = []
                    }
                  } else {
                    if (questionLists.option_list) {
                      modelSelection[three] = []
                      questionLists.option_list.forEach((option_list, i) => {
                        let newselection = {}
                        newselection = {
                          option_id: option_list.option_id,
                          option_name: option_list.option_name,
                          is_other: option_list.is_other
                        }
                        modelSelection[three].push(newselection)
                      })
                    } else {
                    //
                      modelSelection[three] = []
                    }
                    // // 这里就是普通变量
                    threes = {
                      question_name: questionLists.question_name,
                      question_id: questionLists.question_id,
                      relation_id: questionLists.relation_id,
                      show_status: questionLists.show_status,
                      question_describe: questionLists.question_describe ? questionLists.question_describe : '',
                      question_type: questionLists.question_type,
                      option_list: modelSelection.length === 0 ? '' : modelSelection[three]
                    }
                    threeItem[two].push(threes)
                  }
                })
              } else {
              // 这里就是没有变量的
              }
              console.log('threeItem', threeItem)
            }
            z = {
              item_name: second_item.item_name,
              item_id: second_item.xxx ? '0' : second_item.item_id,
              relation_id: second_item.xxx ? '0' : second_item.relation_id,
              show_status: second_item.show_status,
              // is_up_weight: true,
              // 二级模块
              question_data: threeItem[two]
            }
            twoitemData[one].push(z)
          })
          firesitemData[one] = {
            item_name: directoryList.item_name,
            item_id: directoryList.item_id,
            relation_id: directoryList.relation_id,
            show_status: directoryList.show_status,
            // is_up_weight: false,
            // 二级模块
            item_data: twoitemData[one]
          }
        })
      }
      if (this.firstMenus.length >= 1) {
        if (this.firstMenus[0].dir_data === '') {
          this.firstMenus[0].item_data = firesitemData
        } else {
          this.firstMenus[0].dir_data[0].item_data = firesitemData
        }
      }

      console.log('组合好的数据', this.firstMenus)
      // 拿到用户选中的目录
      console.log('NEWdel', NEWdel)
      // console.log('data', data, JSON.stringify(data))
      // 组合数据
      const datas = {
        database_id: this.database_id,
        template_id: this.template_id,
        data: this.firstMenus.length === 0 ? '' : JSON.stringify(this.firstMenus),
        del_arr: newdelarrs === '0' ? NEWdel : '',
        quote_template_id: this.basicTemplateId
      }
      this.$store.dispatch('management/setModuleSelected', [])
      // 清空删除数据
      this.$store.dispatch('management/setDeleteMessages', [])
      // 清空删除目录信息
      this.$store.dispatch('management/setDeletCatalogue', [])

      const zzz = await setTemplateItemAdnQuestion(datas)
      if (zzz.data.code === 0) {
        this.$emit('unableRedirectionFalse', false)
        // 刷新页面
        this.$message.error(zzz.data.msg)
        this.$store.dispatch('management/setModuleSelected', [])
        // 清空删除数据
        this.$store.dispatch('management/setDeleteMessages', [])
        // 清空删除目录信息
        this.$store.dispatch('management/setDeletCatalogue', [])
        this.firstMenus = []
        this.fullscreenLoading = false
        // 重新获取数据
        this.$emit('RetrieveData')
      } else if (zzz.data.code === 1) {
        this.$message.success('保存成功')
        this.saveSuccessfully = true
        this.$emit('unableRedirectionFalse', true)
        console.log('zzzzzzzzzzz', zzz)
        if (zzz.data.data.selectDirId === 0) {
          // 等于0不管
          console.log('等于0不管', zzz.data.data.selectDirId)
        } else {
          console.log('不等于0的时候', zzz.data.data.selectDirId)
          // 将id存起来
          this.$store.dispatch('management/setManagementitemId', zzz.data.data.selectDirId)
        }
        if (this.SubmitToSave === 1) {
          this.fullscreenLoading = false
          return
        }
        // 请求成功之后清空vuex数据
        // await this.$message.success('保存成功')setDeletCatalogue
        this.fullscreenLoading = false
        this.$store.dispatch('management/setModuleSelected', [])
        // 清空删除数据
        this.$store.dispatch('management/setDeleteMessages', [])
        // 清空删除目录信息
        this.$store.dispatch('management/setDeletCatalogue', [])
        // 这里需要发送请求重新获取
        this.$emit('ClickTriggered')
        // this.$forceUpdate()
      } else {
        this.$message.error('保存失败')
        this.$emit('unableRedirectionFalse', false)
        this.$store.dispatch('management/setModuleSelected', [])
        // 清空删除数据
        this.$store.dispatch('management/setDeleteMessages', [])
        // 清空删除目录信息
        this.$store.dispatch('management/setDeletCatalogue', [])
        this.firstMenus = []
        this.fullscreenLoading = false
        // this.$forceUpdate()
      }
    },
    // 用户添加数据的时候确定
    async makeSure() {
      this.dataConfirmation = true
      this.modified = true
      this.$store.dispatch('management/setSetmodified', true)
      console.log('111111111111111111111111111111111111111', this.modified)
      // console.log('textInputValue', this.textInputValue)
      // return

      // 校验
      // try { await this.$refs.rules.validate() } catch (e) {
      //   // console.log('eeee', e)
      //   return this.$message.error('内容不能为空')
      // }
      // 判断表单是否通过
      let is_pass
      this.$refs.ruleForm.validate((valid) => {
        if (valid) {
          is_pass = true
        } else {
          is_pass = false
          return false
        }
      })
      if (!is_pass) return
      // 第一步拿到用户选中的数据
      console.log('这里就是已经拼接好的数据', this.newMenus)
      // 这里数据结构
      console.log('ruleForm', this.ruleForm)
      // 这里需要根据用户选中的数据进行判断 然后进行组合
      // 1是单选
      const question_option = []
      if (this.ruleForm.resource === '1' || this.ruleForm.resource === '2') {
        console.log('单选/多选')
        // 当是单选的时候 需要把用户选中的内容添加到
        this.ruleForm.questionDescribe.forEach((option, i) => {
          question_option[i] = {}
          question_option[i] = {
            option_id: 0,
            option_name:
              option.text.substr(-4) === '____'
                ? option.text.substring(0, option.text.length - 4)
                : option.text,
            is_other: option.text.substr(-4) === '____' ? '1' : '0'
          }
        })
      }
      if (this.ruleForm.resource === '3') {
        // 这里是下拉框
        console.log('下拉')
        this.ruleForm.questionDescribe.forEach((option, i) => {
          question_option[i] = {}
          question_option[i] = {
            option_id: 0,
            option_name: option.text,
            is_other: 0
          }
        })
      }
      if (this.ruleForm.resource === '4') {
        // 附件上传
      }
      if (this.ruleForm.resource === '5') {
        // 文本框
        console.log('文本框')
        // 这里需要判断是单行还是多行
        if (this.textInputValue === '1') {
          // 这里是单行文本
          this.ruleForm.resource = '5'
        } else {
          this.ruleForm.resource = '6'
        }
      }
      if (this.ruleForm.resource === '7') {
        // 其他的就是时间
      } else {
        //
      }
      // 将用户选则的内容添加进去
      // 这里需要分两种情况 第一种是有二级目录 第二种没有二级目录
      console.log('11111111111111111111111111111111111111111111111', question_option, this.newMenus)
      // this.AddSecondary = true
      // 这里就是用户把选项赋值
      this.directoryList.forEach((directoryList, a) => {
        directoryList.second_item.forEach((second_item, b) => {
          if (second_item.question_lists) {
            second_item.question_lists.forEach((question_lists, c) => {
              if (question_lists.question_id === 0 && !question_lists.xxx) {
                console.log('进来了！！！question_key', question_lists)
                // 这里就是用户选中的选项 将用户选中的数据赋值
                // if (this.ruleForm.resource === '3') {
                //   // 如果是下拉就不添加进去
                // } else {
                if (this.ruleForm.resource === '1' || this.ruleForm.resource === '2' || this.ruleForm.resource === '3') {
                  question_lists.option_list = question_option
                } else {
                  question_lists.option_list = ''
                }

                // }
                // question_lists.question_type = this.ruleForm.resource
                // 赋值名字
                question_lists.question_name = this.ruleForm.name
                question_lists.question_describe = this.ruleForm.date1
                this.directoryList[a].second_item[b].question_lists[c].question_type = this.ruleForm.resource
                this.directoryList[a].second_item[b].question_lists[c].xxx = 'heiheihei'
                this.directoryList[a].second_item[b].question_lists[c].question_describe = this.ruleForm.date1
                // question_lists.question_key = 'question_lists.name'
                // question_lists.question_id = Math.ceil(Math.random() * 100000)
              } else {
                if (question_lists.child_question) {
                  question_lists.child_question.forEach((childs, d) => {
                    if (childs.question_id === 0 && !childs.xxx) {
                      if (this.ruleForm.resource === '1' || this.ruleForm.resource === '2' || this.ruleForm.resource === '3') {
                        childs.option_list = question_option
                      } else {
                        childs.option_list = ''
                      }
                      // }
                      // 赋值名字
                      childs.question_name = this.ruleForm.name
                      childs.question_describe = this.ruleForm.date1
                      // childs.option_list = this.ruleForm
                      this.directoryList[a].second_item[b].question_lists[c].child_question[d].xxx = 'heiheihei'
                      this.directoryList[a].second_item[b].question_lists[c].child_question[d].question_type = this.ruleForm.resource
                      this.directoryList[a].second_item[b].question_lists[c].child_question[d].question_describe = this.ruleForm.date1
                    }
                  })
                }
              }
            })
          }
        })
      })
      console.log('question_option', this.newMenus, question_option, this.directoryList)
      // }
      this.addVisible = false
      this.$forceUpdate()
      // 操作数据显示撤销
      this.revocationIsshow = true
      // console.log(' this.directoryList this.directoryList', this.directoryList)
    },
    // 通过change可以拿到用户选择拖拽的模块的数据
    async newHandleRemoves(e) {
      console.log('模块的数据', e, this.directoryList)
      // const listManagement = this.$store.state.management.listManagement
      // // 然后获取id
      // const managementitem_id = this.$store.state.management.managementitem_id
      // 拿到数据
      let first_item_name = []
      if (e.removed.element.item_id === 0) {
        // const first_item_name = []
      } else {
        var data = {
          basicTemplateId: this.basicTemplateId,
          database_id: this.database_id,
          item_id: e.removed.element.item_id
        }
        // 发送请求
        first_item_name = await getInfoBySecondItemId(data)
        console.log('resssssss', first_item_name.data.data)
      }

      // const newRegulates = []
      // 获取用户一二级目录
      this.obtainDirectory()
      console.log(
        'directoryList',
        this.directoryList,
        e.removed.element.item_id,
        this.newMenus
      )
      // 这里开始循环directoryList
      // const itemDatas = []
      // 因为是添加的变量 所以直接循环second_item然后通过second_item循环question_lists然后判断id是否为0
      this.directoryList.forEach((directoryList, a) => {
        directoryList.second_item.forEach((second_item, b) => {
          if (e.removed.element.item_id === second_item.item_id) {
            const twoRegulate = []
            directoryList.second_item.forEach((newSecondItem, index) => {
              if (e.removed.element.item_id === newSecondItem.item_id) {
                // newSecondItem.relation_id = 0
                newSecondItem.invalid_parameter = false
                if (first_item_name === []) {
                  //
                } else {
                  first_item_name.data.data.question_list.forEach((question_lists, i) => {
                    console.log('question_lists', question_lists)
                    question_lists.relation_id = 0
                    question_lists.question_id = 0
                    question_lists.xxx = 'xixiix'
                    if (question_lists.option_list) {
                      question_lists.option_list.forEach((newoptionList) => {
                        newoptionList.option_id = 0
                      })
                    }
                    if (question_lists.child_question) {
                      question_lists.child_question.forEach((child_question, i) => {
                        if (child_question.option_list) {
                          child_question.option_list.forEach((lists, z) => {
                            lists.option_id = 0
                            // newlists[z] = {
                            //   option_id: 0,
                            //   option_name: lists.option_name,
                            //   is_other: lists.is_other
                            // }
                          })
                        }
                        child_question.question_id = 0
                        child_question.relation_id = 0
                        // childQuest[i] = {
                        //   question_name: child_question.question_name,
                        //   question_id: 0,
                        //   relation_id: 0,
                        //   show_status: child_question.show_status,
                        //   question_type: child_question.question_type,
                        //   option_list: child_question.option_list ? newlists : ''
                        // }
                      })
                      // twoRegulate[i].child_question = childQuest
                    }
                    twoRegulate[i] = []
                    twoRegulate[i] = question_lists
                  })
                }

                // newSecondItem.question_id = Math.ceil(Math.random() * 100000)
                // newSecondItem.item_data = twoRegulate
                newSecondItem.question_lists = twoRegulate
                // newSecondItem.item_id = 0
                // newSecondItem.parent_id = 0
                newSecondItem.xxx = 'heihei'
                // newSecondItem.template_id = 0
                // }
              } else {
                // itemDatas[index] = newSecondItem
                //  itemDatas[index].question_lists
              }
            })
          }
        })
      })
      console.log('this.newMenus', this.newMenus, this.directoryList)
      // 赋值
      this.newDataList = this.directoryList
      this.$forceUpdate()
      // 操作数据显示撤销
      this.revocationIsshow = true
    },
    // 通过change可以拿到用户选择拖拽的变量的数据
    newHandleRemove(e) {
      this.AddSecondary = false
      console.log('拖拽新增数据', e)
      if (e.removed) {
        if (e.removed.element.question_type === 0) {
          //
          console.log('这里就是等于0的时候！！！！', this.is_group)
        }
      }
      this.newMenus = [] // 清空用户选中的目录
      const newOptions = [] // 这个数据就是排列用户的选项的数据
      console.log('handleRemove', e)
      // 获取用户一二级目录
      this.obtainDirectory()
      // 这里开始循环directoryList
      // 因为是添加的变量 所以直接循环second_item然后通过second_item循环question_lists然后判断id是否为0
      this.directoryList.forEach((directoryList) => {
        directoryList.second_item.forEach((second_item) => {
          if (second_item.question_lists) {
            console.log('second_itemwwwwwwwwwwwwwwwwwwwwwwwwwwww', second_item)
            second_item.question_lists.forEach((question_lists) => {
              if (question_lists.question_id === 0 && !question_lists.xxx) {
                if (second_item.item_id === 0) {
                  // 二级模块
                  const twoModule = []
                  console.log(
                    '这里就是用户选中的选项',
                    directoryList,
                    second_item,
                    question_lists
                  )
                  directoryList.second_item.forEach((secondItems, i) => {
                    if (secondItems.item_id === 0) {
                      secondItems.question_lists.forEach((questionsList, index) => {
                        newOptions[index] = {}
                        if (questionsList.question_id === 0 && !questionsList.xxx) {
                          newOptions[index] = {
                            question_name: questionsList.question_name,
                            question_id: questionsList.question_id,
                            relation_id: questionsList.relation_id,
                            show_status: questionsList.show_status,
                            question_type: questionsList.question_type
                          }
                        } else {
                          newOptions[index] = questionsList
                        }
                        twoModule[i] = {
                          item_name: secondItems.item_name,
                          item_id: secondItems.item_id,
                          relation_id: secondItems.relation_id,
                          show_status: secondItems.show_status,
                          // 一级变量
                          question_data: newOptions
                        }
                      })
                    } else {
                      twoModule[i] = {
                        item_name: secondItems.item_name,
                        item_id: secondItems.item_id,
                        relation_id: secondItems.relation_id,
                        show_status: secondItems.show_status
                      }
                    }
                  })
                  // 这里就需要对接用户选中的数据了
                  // 这里需要判断 用户选中的是目录是一级目录还是二级目录 this.newMenus.dir_data的里面是否有数据
                  // 如果有数据 那么需要将数据添加到this.newMenus.dir_data的下面item_data里面
                  // if (this.newMenus[0].dir_data.length >= 1) {
                  //   console.log(
                  //     '进来了说明用户选中的目录有二级目录',
                  //     this.newMenus[0].dir_data,
                  //     question_lists
                  //   )
                  //   // 这里直接添加到this.newMenus[0].dir_data[0].item_data里面
                  //   // 一级模块
                  //   this.newMenus[0].dir_data[0].item_data = [
                  //     {
                  //       item_name: directoryList.item_name,
                  //       item_id: directoryList.item_id,
                  //       relation_id: directoryList.relation_id,
                  //       show_status: directoryList.show_status,
                  //       // 二级模块
                  //       item_data: twoModule

                  //     }
                  //   ]
                  // } else {
                  // // 如果没有就需要把数据添加到一级目录的item_data下面
                  //   console.log(
                  //     '这里说明用户选中的一级目录下没有二级目录',
                  //     this.newMenus
                  //   )
                  //   this.newMenus[0].item_data = [
                  //     {
                  //     // 一级模块
                  //       item_name: directoryList.item_name,
                  //       item_id: directoryList.item_id,
                  //       relation_id: directoryList.relation_id,
                  //       show_status: directoryList.show_status,
                  //       // 二级模块
                  //       item_data: twoModule
                  //     }
                  //   ]
                  // }
                } else {
                  console.log(
                    '这里就是用户选中的选项',
                    directoryList,
                    second_item,
                    question_lists
                  )
                  second_item.question_lists.forEach((questionsList, index) => {
                    newOptions[index] = {}
                    if (questionsList.question_id === 0 && !questionsList.xxx) {
                      newOptions[index] = {
                        question_name: questionsList.question_name,
                        question_id: questionsList.question_id,
                        relation_id: questionsList.relation_id,
                        show_status: questionsList.show_status,
                        question_type: questionsList.question_type
                      }
                    } else {
                      newOptions[index] = questionsList
                    }
                  })
                  // 这里就需要对接用户选中的数据了
                  // 这里需要判断 用户选中的是目录是一级目录还是二级目录 this.newMenus.dir_data的里面是否有数据
                  // 如果有数据 那么需要将数据添加到this.newMenus.dir_data的下面item_data里面
                  // if (this.newMenus[0].dir_data.length >= 1) {
                  //   console.log(
                  //     '进来了说明用户选中的目录有二级目录',
                  //     this.newMenus[0].dir_data,
                  //     question_lists
                  //   )
                  //   // 这里直接添加到this.newMenus[0].dir_data[0].item_data里面
                  //   // 一级模块
                  //   this.newMenus[0].dir_data[0].item_data = [
                  //     {
                  //       item_name: directoryList.item_name,
                  //       item_id: directoryList.item_id,
                  //       relation_id: directoryList.relation_id,
                  //       show_status: directoryList.show_status,
                  //       // 二级模块
                  //       item_data: [
                  //         {
                  //           item_name: second_item.item_name,
                  //           item_id: second_item.item_id,
                  //           relation_id: second_item.relation_id,
                  //           show_status: second_item.show_status,
                  //           // 一级变量
                  //           question_data: newOptions
                  //         }
                  //       ]
                  //     }
                  //   ]
                  // } else {
                  // // 如果没有就需要把数据添加到一级目录的item_data下面
                  //   console.log(
                  //     '这里说明用户选中的一级目录下没有二级目录',
                  //     this.newMenus
                  //   )
                  //   this.newMenus[0].item_data = [
                  //     {
                  //     // 一级模块
                  //       item_name: directoryList.item_name,
                  //       item_id: directoryList.item_id,
                  //       relation_id: directoryList.relation_id,
                  //       show_status: directoryList.show_status,
                  //       // 二级模块
                  //       item_data: [
                  //         {
                  //           item_name: second_item.item_name,
                  //           item_id: second_item.item_id,
                  //           relation_id: second_item.relation_id,
                  //           show_status: second_item.show_status,
                  //           // 一级变量
                  //           question_data: newOptions
                  //         }
                  //       ]
                  //     }
                  //   ]
                  // }
                }
              } else {
                if (question_lists.child_question) {
                  // console.log('进来了', question_lists)
                  question_lists.child_question.forEach((childs) => {
                    if (childs.question_id === 0 && !childs.xxx) {
                      // 进来这里需要给一个数据的变化
                      this.AddSecondary = true
                      // 进来这里的就是用户修改的数据
                      console.log('进来这里的就是用户修改的数据', childs, question_lists, second_item, directoryList)
                      if (second_item.item_id === 0) {
                        // 二级模块
                        const twoModule = []
                        console.log(
                          '这里就是用户选中的选项',
                          directoryList,
                          second_item,
                          question_lists
                        )
                        directoryList.second_item.forEach((secondItems, i) => {
                          if (secondItems.item_id === 0) {
                            secondItems.question_lists.forEach((questionsList, index) => {
                              newOptions[index] = {}
                              if (questionsList.child_question) {
                                newOptions[index] = {
                                  question_name: questionsList.question_name,
                                  question_id: questionsList.question_id,
                                  relation_id: questionsList.relation_id,
                                  show_status: questionsList.show_status,
                                  question_type: questionsList.question_type,
                                  child_question: questionsList.child_question
                                }
                              } else {
                                newOptions[index] = questionsList
                              }

                              twoModule[i] = {
                                item_name: secondItems.item_name,
                                item_id: secondItems.item_id,
                                relation_id: secondItems.relation_id,
                                show_status: secondItems.show_status,
                                // 一级变量
                                question_data: newOptions
                              }
                            })
                          } else {
                            twoModule[i] = {
                              item_name: secondItems.item_name,
                              item_id: secondItems.item_id,
                              relation_id: secondItems.relation_id,
                              show_status: secondItems.show_status
                            }
                          }
                        })
                        // 这里就需要对接用户选中的数据了
                      } else {
                        second_item.question_lists.forEach((questionsList, index) => {
                          newOptions[index] = {}
                          if (!questionsList.question_key && !questionsList.xxx) {
                            newOptions[index] = {
                              question_name: questionsList.question_name,
                              question_id: questionsList.question_id,
                              relation_id: questionsList.relation_id,
                              show_status: questionsList.show_status,
                              question_type: questionsList.question_type
                            }
                          } else {
                            newOptions[index] = questionsList
                          }
                        })
                      }
                    }
                  })
                } else {
                  // console.log('剩下的！！！！！！！！！！！！！', question_lists)
                }
              }
            })
          }
        })
      })
      console.log('this.newMenus', this.newMenus)
    },
    newchoose(e) {
      console.log('choose', e)
    },
    // 用户每次选择模块之后 都需要调用重新赋值
    newItems() {
      this.items = [
        {
          question_name: '变量组',
          question_type: 0,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '单选',
          question_type: 1,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '多选',
          question_type: 2,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '下拉',
          question_type: 3,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '附件上传',
          question_type: 4,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '单行文本',
          question_type: 5,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '多行文本',
          question_type: 6,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        },
        {
          question_name: '时间(y-m-d)',
          question_type: 7,
          question_id: 0,
          show_status: 1,
          create_type: 1,
          relation_id: 0,
          is_select: false
        }
      ]
    },
    // 封装调用接口 用户每次拖拽需要重新调用一次接口
    async newSecondItem() {
      const data = {
        basicTemplateId: this.basicTemplateId,
        database_id: this.database_id
      }
      // 进入这里直接发送请求调用模块信息
      const res = await getTemplateSecondItem(data)
      console.log('请求调用模块信息', res)
      // 赋值渲染
      this.second_items_add = res.data.data
    },
    // 这里就是tab栏切换
    handleClick(tab, event) {
      console.log(tab, event)
    },
    // 内部拖拽触发
    newsOnStarts(e) {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      this.is_group = false
      this.modified = true
      this.$store.dispatch('management/setSetmodified', true)
      this.newSites = false
      this.drag = true
      console.log('只能内部拖拽', this.is_group, this.newSites)
      if (e.item.style.width === '100%') {
        // this.newSites = true
        this.newsisGroup = true
        console.log('进来了需要禁止拖拽进一级')
        // return
      }
      // this.$forceUpdate()
    },
    // 拖拽
    onStarts(e) {
      this.is_group = false
      this.newSites = false
      console.log('eeeee我被触发拉！！！！', this.newSites, this.is_group, this.newVariable, this.newsisGroup)
      this.drag = true
      this.$store.dispatch('management/setSetmodified', true)
    },
    // 开始拖拽
    newresonStart(e) {
      console.log('开始拓展类1！！！！！！！！！')
      if (this.IsItOperable === 0) {
        this.newSiteList = 'wwwwwww'
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        const z = setTimeout(() => {
          this.newSiteList = 'site'
          clearTimeout(z)
        }, 2000)

        return
      }
      if (e.oldIndex === 0) {
        this.is_group = false
        this.newSites = false
        // this.newsisGroup = true
        this.newVariable = true
      } else {
        this.is_group = false
        this.newSites = true
      }
      console.log('eeeeeeeeeeeeeeeeeeee', this.is_group, this.newSites)
      this.drag = true
      console.log('开始')
      this.modified = true
      this.$store.dispatch('management/setSetmodified', true)
      this.newclickable = false
      // z只要用户拖拽新增数据就禁止NoStarting
      // this.NoStarting = false
    },
    onStart(e) {
      if (this.IsItOperable === 0) {
        this.newssecondSite = 'dddddd'
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        const z = setTimeout(() => {
          this.newssecondSite = 'second-site'
          clearTimeout(z)
        }, 2000)

        return
      }
      let z = 0
      // invalid_parameter
      // console.log('eeeeeeeeeeeeeeeeeeee', e.oldIndex, this.directoryList, this.directoryList[0].hasOwnProperty('item_id'))
      if (this.directoryList.length === 0) {
        console.log('等于0就进来了')
        this.directoryList = [
          {
            item_id: 0,
            item_name: '新增模块',
            relation_id: 0,
            show_status: 1,
            second_item: []
          }
        ]
        z = 1
      }

      this.is_group = true
      this.drag = true
      console.log('开始')
      this.modified = true
      this.$store.dispatch('management/setSetmodified', true)
      this.newclickable = false
      if (z === 1) {
        const ddd = setTimeout(() => {
          this.newDataListFalse = true
          clearTimeout(ddd)
        }, 1000)
      }
    },
    /* 拖拽一级模块 */
    newwraponStart() {
      console.log('拖拽一级模块')
    },
    // 这里就是模块结束 结束之后拿到数据发送请求
    onEnds(e) {
      // 当前组拖动，返回
      if (e.to.__vue__.$attrs.animation === '100') return
      // 重置选中模块id
      this.select_module_id = ''
      // this.drag = false
      // 需要拿到用户是拖拽变量组还是选项
      this.is_group = false
      console.log('结束拖拽', e, this.directoryList)
      this.newSecondItem()
      // this.newItems()
    },
    // 这里是模块间的拖拽
    twosVariable(e) {
      // 获取用户一二级目录
      this.obtainDirectory()
      console.log('这里是模块间的拖拽', e, this.newMenus, this.directoryList)
      let parentID = ''
      // 通过item_id可以拿到拖拽的目的地的数据
      let itemID = ''
      if (e.removed) {
        // moved
        return
        // parentID = e.removed.element.parent_id
        // itemID = e.removed.element.item_id
      } else if (e.added) {
        parentID = e.added.element.parent_id
        itemID = e.added.element.item_id
      } else {
        parentID = e.moved.element.parent_id
        itemID = e.moved.element.item_id
      }
      // 可以通过用户拖拽的数据拿到拖拽之前的数据=== undefined ? e.removed.element.item_id : e.added.element.item_id
      // 拖拽前的数据位置
      const frontFirstInformation = []
      const fontTwoInformation = []
      // const parentID = e.added.element.parent_id
      //     // 通过item_id可以拿到拖拽的目的地的数据
      //     const itemID = e.added.element.item_id
      console.log('itemID', parentID)
      // 循环数据
      this.directoryList.forEach((directoryList) => {
        // console.log('directoryList', directoryList)
        if (parentID === directoryList.item_id) {
          // 进来这里说明这里就是用户拖拽的数据
          console.log('拼接拖拽的数据')
          console.log('directoryList', directoryList)
          if (directoryList.second_item.length >= 1) {
            // 如果进来说明用户还有其他的二级模块 需要组装起来
            directoryList.second_item.forEach((second_item, index) => {
              // 将所有剩余的second_item全部拼接起来
              fontTwoInformation[index] = {
                item_name: second_item.item_name,
                item_id: second_item.item_id,
                relation_id: second_item.relation_id,
                show_status: second_item.show_status,
                question_data: ''
              }
            })
          } else {
            // 如果没有就不管传空字符串

          }
          frontFirstInformation[0] = {
            item_name: directoryList.item_name,
            item_id: directoryList.item_id,
            relation_id: directoryList.relation_id,
            show_status: directoryList.show_status,
            item_data: fontTwoInformation.length === 0 ? '' : fontTwoInformation
          }
          console.log('frontFirstInformation', frontFirstInformation)
        }
      })
      // 拿到数据开始循环
      // 一级模块的数据，
      const firstInformation = []
      // 二级模块的数据
      const twoInformation = []
      const threequestionData = []
      this.directoryList.forEach((directoryList, i) => {
        // console.log('directoryList', directoryList)
        directoryList.second_item.forEach((second_item) => {
          second_item.question_lists.forEach((newquestionLists, i) => {
            threequestionData[i] = newquestionLists
          })
          if (itemID === second_item.item_id) {
            // 进来说明这里就是用户修改的二级模块
            console.log('second_item', directoryList, second_item)
            twoInformation[0] = {
              item_name: second_item.item_name,
              item_id: second_item.item_id,
              relation_id: second_item.relation_id,
              show_status: second_item.show_status,
              question_data: threequestionData
            }
            firstInformation[0] = {
              item_name: directoryList.item_name,
              item_id: directoryList.item_id,
              relation_id: directoryList.relation_id,
              show_status: directoryList.show_status,
              item_data: twoInformation
            }
          }
          // 进入这里就是可以拿到用户选中的模块
          // 将数据拼接起来
        })
      })
      console.log(firstInformation, twoInformation, frontFirstInformation)
      // 这里需要判断用户拖拽的数据和被拖拽的数据是否在一个一级模块下 如果是直接拿最新的
      const ItemData = []
      // 如果不是就把把两个一级模块拼接起来
      if (firstInformation[0].item_id === frontFirstInformation[0].item_id) {
        // 如果进来说明是同一个一级目录
        // 直接拿拼接的数据
        ItemData.push(frontFirstInformation[0])
      } else {
        // 这里是两个不同的一级模块
        ItemData.push(firstInformation[0])
        ItemData.push(frontFirstInformation[0])
      }
      // 将数据拼接起来
      if (this.newMenus[0].dir_data.length >= 1) {
        this.newMenus[0].dir_data[0].item_data = ItemData
      } else {
        this.newMenus[0].item_data = ItemData
      }
      console.log('拿到拼接完成的数据', this.newMenus, ItemData)
      // 拿vuex看用户是否选中过数据
      console.log(this.$store.state.management.moduleSelected)
      this.saveData(this.newMenus)
    },
    newAnswerSome(e) {
      console.log(e)
    },
    // 拖拽变量改变位置
    AnswerSome(e) {
      console.log('eeeee这里是选项的拖拽', e, this.directoryList)
      this.newsisGroup = false
      // 操作数据显示撤销
      this.revocationIsshow = true
    },
    // 这里就是二级变量拖拽切换位置
    newAnswerSomelist(e) {
      // if (!this.NoStarting) {
      //   console.log('用户新增变量组下面数据')
      //   return
      // }
      console.log('拖拽到变量组下面的数据')
      // this.obtainDirectory()
      console.log('eeee', e, this.directoryList)
      let questionId = ''
      if (e.removed) {
        // moved
        return
      } else if (e.added) {
        questionId = e.added.element.question_id
      } else {
        questionId = e.moved.element.question_id
      }
      // 拿到用户拖拽完成的数据
      const itemData = []
      this.directoryList.forEach((directoryList) => {
        directoryList.second_item.forEach((second_item) => {
          second_item.question_lists.forEach((question_lists) => {
            // question_lists.
            if (question_lists.child_question) {
              question_lists.child_question.forEach((child_question) => {
                if (child_question.question_id === questionId) {
                  const firstVariable = []
                  console.log(directoryList, second_item, question_lists, child_question)
                  second_item.question_lists.forEach((newquestionLists, one) => {
                    if (newquestionLists.child_question) {
                      const newChildquestion = []
                      newquestionLists.child_question.forEach((childQuestion, i) => {
                        newChildquestion[i] = {}
                        if (childQuestion.option_list) {
                          newChildquestion[i] = {
                            question_name: childQuestion.question_name,
                            question_id: childQuestion.question_id,
                            relation_id: childQuestion.relation_id,
                            show_status: childQuestion.show_status,
                            question_type: childQuestion.question_type,
                            option_list: childQuestion.option_list
                          }
                        } else {
                          newChildquestion[i] = {
                            question_name: childQuestion.question_name,
                            question_id: childQuestion.question_id,
                            relation_id: childQuestion.relation_id,
                            show_status: childQuestion.show_status,
                            question_type: childQuestion.question_type,
                            option_list: ''
                          }
                        }
                      })
                      firstVariable[one] = {
                        // 一级变量
                        question_name: newquestionLists.question_name,
                        question_id: newquestionLists.question_id,
                        relation_id: newquestionLists.relation_id,
                        show_status: newquestionLists.show_status,
                        question_type: newquestionLists.question_type,
                        child_question: newChildquestion.length === 0 ? '' : newChildquestion
                      }
                    } else {
                      // 这里就是没有child拼接的部分
                      if (newquestionLists.option_list) {
                        //
                      } else {
                        newquestionLists.option_list = ''
                      }
                      firstVariable[one] = {
                        question_name: newquestionLists.question_name,
                        question_id: newquestionLists.question_id,
                        relation_id: newquestionLists.relation_id,
                        show_status: newquestionLists.show_status,
                        question_type: newquestionLists.question_type,
                        option_list: newquestionLists.option_list
                      }
                    }
                  })
                  // 将数据拼接起来
                  itemData[0] = {
                    // 一级模块
                    item_name: directoryList.item_name,
                    item_id: directoryList.item_id,
                    relation_id: directoryList.relation_id,
                    show_status: directoryList.show_status,
                    item_data: [
                      // 二级模块
                      {
                        item_name: second_item.item_name,
                        item_id: second_item.item_id,
                        relation_id: second_item.relation_id,
                        show_status: second_item.show_status,
                        question_data: firstVariable
                      }
                    ]
                  }
                }
              })
            } else {
              if (question_lists.question_id === questionId) {
                // 这里说明用户跨模块拖拽
                console.log('这里说明用户跨模块拖拽', question_lists)
                // this.$message.error('禁止跨变量拖拽')
                // this.$forceUpdate()
              }
            }
          })
        })
      })
      this.$forceUpdate()
    },
    // 拖拽变量改变位置
    newAnswerSomes(e) {
      this.drag = false
      this.newSites = true
      // console.log('拖拽完成的事件', e, this.directoryList)
    },
    // 结束拖拽
    onEnd(e) {
      this.drag = false
      // 在当前拖动，不显示弹框
      if (e.to.__vue__.$attrs.animation === '100') return
      // 需要拿到用户是拖拽变量组还是选项
      console.log('结束拖拽', e, this.directoryList)
      if (e.item.innerText.trim() === '变量组') {
        this.question_varisible_item = true
      } else {
        this.addVisible = true
      }
      // 给添加变量弹框，赋值选项
      const ITEM_NAME = {
        one: '单选',
        two: '多选',
        three: '下拉',
        four: '附件上传',
        five: '单行文本',
        six: '多行文本',
        seven: '时间(y-m-d)'
      }
      const item_name = e.item.innerText.trim()
      switch (item_name) {
        case ITEM_NAME.one:
          this.ruleForm.resource = '1'
          break
        case ITEM_NAME.two:
          this.ruleForm.resource = '2'
          break
        case ITEM_NAME.three:
          this.ruleForm.resource = '3'
          break
        case ITEM_NAME.four:
          this.ruleForm.resource = '4'
          break
        case ITEM_NAME.five:
          this.ruleForm.resource = '5'
          this.textInputValue = '1'
          break
        case ITEM_NAME.six:
          this.ruleForm.resource = '6'
          this.textInputValue = '2'
          break
        case ITEM_NAME.seven:
          this.ruleForm.resource = '7'
          break
        default:
      }
      // this.newSecondItem()
      this.newItems()
      this.newVariable = false
    },
    // 改变添加选项
    changeSlectItem(id) {
      console.log(id)
      if (id === 0) {
        this.is_slect_item = false
      } else {
        this.is_slect_item = true
      }
    },
    // 关闭添加变量弹框触发
    addVisibleClose() {
      console.log('我被删除了', this.directoryList)
      // 清除表单数据数据
      this.is_group = false
      this.$refs.ruleForm.clearValidate()
      this.ruleForm = {
        resource: '1', // 选项类型
        questionDescribe: [{ text: '' }]
      }
      this.addVisible = false
      // 删除取消添加变量数据
      if (this.dataConfirmation) {
        this.dataConfirmation = false
      } else {
        console.log('zhel?')
        // const ITEM_NAME_ARR = [
        //   '单选',
        //   '多选',
        //   '下拉',
        //   '附件上传',
        //   '单行文本',
        //   '多行文本',
        //   '时间(y-m-d)'
        // ]
        for (let i = 0, i_length = this.directoryList.length; i < i_length; i++) {
          const second_item = this.directoryList[i].second_item
          for (let j = 0, j_length = second_item.length; j < j_length; j++) {
            const question_lists = this.directoryList[i].second_item[j].question_lists
            for (let l = 0, l_length = question_lists.length; l < l_length; l++) {
              const question_id = question_lists[l].question_id
              // if (ITEM_NAME_ARR.indexOf(question_name) > -1 && !('xxx' in question_lists[l])) {
              //   this.directoryList[i].second_item[j].question_lists.splice(l, 1)
              //   break
              // }
              if (question_id === 0 && !('xxx' in question_lists[l])) {
                this.directoryList[i].second_item[j].question_lists.splice(l, 1)
                break
              } else if (question_lists[l].child_question) {
                question_lists[l].child_question.forEach((child_question, index) => {
                  if (child_question.question_id === 0 && !child_question.xxx) {
                    console.log('进来了1', this.directoryList[i].second_item[j].question_lists[l].child_question, index)
                    this.directoryList[i].second_item[j].question_lists[l].child_question.splice(index, 1)
                  }
                })
              }
            }
          }
        }
      }
    },
    // 添加变量弹框方法
    // 添加单选多选输入框
    addSingleItem(id, index) {
      switch (id) {
        // 变量
        case 1:
          this.ruleForm.questionDescribe.push({ text: '' })
          break
        case 2:
          this.ruleForm.questionDescribe.push({ text: '其他____' })
          break
        // 题组
        case 3:
          console.log(3)
          this.newAddForm.varisibleItem[index].questionDescribe.push({
            text: ''
          })
          break
        default:
          this.newAddForm.varisibleItem[index].questionDescribe.push({
            text: '其他____'
          })
      }
    },
    // 减去单选多选输入框
    minusSingleItem(id, index) {
      if (this.ruleForm.questionDescribe.length > 1) {
        this.ruleForm.questionDescribe.splice(index, 1)
      } else {
        this.$message.error('最少需要一个选项')
      }
    },
    // 题组减去单选多选输入框
    minusQuetionSingleItem(index, index1) {
      if (this.newAddForm.varisibleItem[index].questionDescribe.length > 1) {
        this.newAddForm.varisibleItem[index].questionDescribe.splice(index1, 1)
      } else {
        this.$message.error('最少需要一个选项')
      }
    },
    // 关闭批量操作触发
    mostColse() {
      this.mostData = ''
    },
    // 新增题组函数
    addVisibleItemArr() {
      console.log(1)
      const varisibleItem = {
        name: '', // 名字
        varisibleDescrible: '', // 变量描述
        resource: '1', // 选项类型
        questionDescribe: [{ text: '' }],
        textInputValue: '1',
        desc: ''
      }
      this.newAddForm.varisibleItem.push(varisibleItem)
    },
    // 减去题组函数
    minusVarisibleItem(index) {
      if (this.newAddForm.varisibleItem.length > 1) {
        this.newAddForm.varisibleItem.splice(index, 1)
      } else {
        this.$message.error('最少需要一个选项')
      }
    },
    // 关闭题组弹框触发
    quetionItemVisibleClose() {
      // 删除取消添加题组数据
      console.log('全部数据', this.directoryList)
      // const ITEM_NAME_ARR = [
      //   '变量组'
      // ]
      for (let i = 0, i_length = this.directoryList.length; i < i_length; i++) {
        const second_item = this.directoryList[i].second_item
        for (let j = 0, j_length = second_item.length; j < j_length; j++) {
          const question_lists = this.directoryList[i].second_item[j].question_lists
          for (let l = 0, l_length = question_lists.length; l < l_length; l++) {
            // const question_name = question_lists[l].question_name
            if (question_lists[l].question_id === 0 && !('xxx' in question_lists[l])) {
              this.directoryList[i].second_item[j].question_lists.splice(l, 1)
              break
            }
          }
        }
      }
      // 清除数据
      this.$refs.twoRuleForm.clearValidate()
      this.newAddForm = {
        name: '', // 名字
        date1: '', // 变量描述
        // 变量数组
        varisibleItem: [
          {
            name: '', // 名字
            varisibleDescrible: '', // 变量描述
            resource: '1', // 选项类型
            questionDescribe: [{ text: '' }],
            textInputValue: '1',
            desc: ''
          }
        ]
      }
    },
    // 验证题组弹框输入不能为空
    testQuetionItemInput() {
      let is_pass = true
      if (this.newAddForm.name === '') {
        is_pass = false
      }
      if (is_pass) {
        this.newAddForm.varisibleItem.forEach((item, index) => {
          if (item.name === '') {
            is_pass = false
          }
        })

        this.newAddForm.varisibleItem.forEach(item => {
          item.questionDescribe.forEach(item2 => {
            if (item2.text === '' && item.resource < 4) {
              is_pass = false
            }
          })
        })
      }
      return is_pass
    },
    // 题组提交数据
    quetionItemConfirm() {
      // 拿到提组的数据
      console.log(this.newAddForm)
      // 校验
      const is_pass_input = this.testQuetionItemInput()
      console.log('is_pass_input', is_pass_input)

      if (!is_pass_input) {
        this.$message.error('变量名称和选项不能为空')
        return false
      }
      // 判断表单是否通过
      // let is_pass
      // console.log(4564654654654)
      // console.log(this.$refs)
      // this.$refs.twoRuleForm.validate((valid) => {
      //   console.log(9663652)
      //   if (valid) {
      //     console.log(1)
      //     is_pass = true
      //   } else {
      //     console.log(0)
      //     is_pass = false
      //     return false
      //   }
      // })
      if (!is_pass_input) return
      // 拿到数据
      console.log(' this.directoryList', this.directoryList)
      console.log(' this.newMenus', this.newMenus)
      // 拿到 二级变量 的信息
      // 声明一个数据存储二级变量名称
      const newvariable = []
      // const twoOptions = []
      let zzz = []
      const twoOptions = []
      this.newAddForm.varisibleItem.forEach((twoVariable, i) => {
        twoOptions[i] = []
        zzz = {}
        console.log('````````````````````````````````````', twoVariable)
        twoVariable.questionDescribe.forEach((questionDescribe, index) => {
          zzz[index] = {
            option_id: 0,
            option_name:
              questionDescribe.text.substr(-4) === '____'
                ? questionDescribe.text.substring(
                  0,
                  questionDescribe.text.length - 4
                )
                : questionDescribe.text,
            is_other: questionDescribe.text.substr(-4) === '____' ? '1' : '0'
          }
          twoOptions[i].push(zzz[index])
        })

        console.log('twoVariable', twoVariable, zzz, twoOptions) // 这里的twoVariable就是二级变量信息
        // 需要判断用户选中的是哪一个
        // 这里说明是单选多选下拉
        if (twoVariable.resource === '1' || twoVariable.resource === '2' || twoVariable.resource === '3') {
          newvariable[i] = {
            question_name: twoVariable.name,
            question_id: 0,
            relation_id: 0,
            show_status: 1,
            xxx: 'hhh',
            question_type: twoVariable.resource,
            question_describe: twoVariable.varisibleDescrible,
            option_list: twoOptions[i]
          }
        } else if (twoVariable.resource === '4') {
          // 等于4是附件上传
          newvariable[i] = {
            question_name: twoVariable.name,
            question_id: 0,
            relation_id: 0,
            show_status: 1,
            xxx: 'hhh',
            question_type: twoVariable.resource,
            question_describe: twoVariable.varisibleDescrible,
            option_list: ''
          }
        } else if (twoVariable.resource === '5') {
          // 等于5是文本
          newvariable[i] = {
            question_name: twoVariable.name,
            question_id: 0,
            relation_id: 0,
            show_status: 1,
            xxx: 'hhh',
            question_type: twoVariable.resource,
            question_describe: twoVariable.varisibleDescrible,
            option_list: ''
          }
          if (twoVariable.textInputValue === '1') {
            // 等于1就是单行文本
            twoVariable.resource = '5'
            newvariable[i] = {
              question_name: twoVariable.name,
              question_id: 0,
              relation_id: 0,
              show_status: 1,
              xxx: 'hhh',
              question_type: twoVariable.resource,
              question_describe: twoVariable.varisibleDescrible,
              option_list: ''
            }
          } else {
            // 等于2就是多行文本
            twoVariable.resource = '6'
            newvariable[i] = {
              question_name: twoVariable.name,
              question_id: 0,
              relation_id: 0,
              show_status: 1,
              xxx: 'hhh',
              question_type: twoVariable.resource,
              question_describe: twoVariable.varisibleDescrible,
              option_list: ''
            }
          }
        } else if (twoVariable.resource === '7') {
          // 这里就是时间
          newvariable[i] = {
            question_name: twoVariable.name,
            question_id: 0,
            relation_id: 0,
            show_status: 1,
            xxx: 'hhh',
            question_type: twoVariable.resource,
            question_describe: twoVariable.varisibleDescrible,
            option_list: ''
          }
        }
      })
      // 循环 提组 拿到需要的数据
      const Assembly = []
      // Assembly[0] = {
      //   question_name: this.newAddForm.name,
      //   question_describe: this.newAddForm.dete1,
      //   question_id: 0,
      //   relation_id: 0,
      //   show_status: 1,
      //   question_type: 0,
      //   child_question: newvariable
      // }
      // console.log('Assembly', Assembly)
      // 因为进来就是添加变量组 变量组的id就是0 所以直接判断
      // 首先循环this.directoryList
      const firstModule = []
      const towModule = []
      this.directoryList.forEach((directoryList, a) => {
        console.log('========================', directoryList)
        directoryList.second_item.forEach((second_item, b) => {
          if (second_item.question_lists) {
            second_item.question_lists.forEach((question_lists, c) => {
              if (question_lists.question_id === 0 && !question_lists.xxx) {
                second_item.question_lists.forEach((newquestionLists, d) => {
                  console.log('newquestionLists', newquestionLists)
                  if (newquestionLists.question_id === 0 && !newquestionLists.xxx) {
                    Assembly[d] = {
                      question_name: this.newAddForm.name,
                      question_describe: this.newAddForm.date1,
                      question_id: 0,
                      relation_id: 0,
                      show_status: 1,
                      question_type: 0,
                      // xxx: 'hhh',
                      child_question: newvariable
                    }
                    console.log('这里就是用户选中的变量组', newquestionLists)
                    // 渲染
                    question_lists.question_name = this.newAddForm.name
                    // 生成一个随机数 避免用户下次添加的时候遇到id重复
                    // question_lists.question_id = Math.ceil(Math.random() * 100000)
                    // 渲染到页面
                    this.directoryList[a].second_item[b].question_lists[c].question_describe = this.newAddForm.date1
                    this.directoryList[a].second_item[b].question_lists[c].xxx = 'heiheihei'
                    this.directoryList[a].second_item[b].question_lists[c].child_question
                    question_lists.child_question = newvariable
                    // 因为这里是用户选中的变量组 需要以变量组的形式渲染
                    // 二级模块 second_item
                    towModule[0] = {
                      item_name: second_item.item_name,
                      item_id: second_item.item_id,
                      relation_id: second_item.relation_id,
                      show_status: second_item.show_status,
                      question_data: Assembly
                    }
                    // 一级模块 directoryList
                    firstModule[0] = {
                      item_name: directoryList.item_name,
                      item_id: directoryList.item_id,
                      relation_id: directoryList.relation_id,
                      show_status: directoryList.show_status,
                      item_data: towModule
                    }
                  } else {
                    //  questionData.child_question = questionData.child_question ? questionData.child_question : ''
                    if (newquestionLists.question_type === 0) {
                      newquestionLists.child_question = newquestionLists.child_question ? newquestionLists.child_question : ''
                    }
                    Assembly[d] = newquestionLists
                  }
                })
              }
            })
          }
        })
      })
      // if (this.newMenus[0].dir_data.length >= 1) {
      //   // question_list
      //   console.log(
      //     '进来了说明用户选中的目录有二级目录',
      //     this.newMenus[0].dir_data
      //   )
      //   // 这里还需要将数据拼接到用户页面上显示出来

      //   // console.log('========================', newRegulates)
      //   this.newMenus[0].dir_data[0].item_data = firstModule
      // } else {
      //   // 如果没有就需要把数据添加到一级目录的item_data下面
      //   console.log('这里说明用户选中的一级目录下没有二级目录', this.newMenus)
      //   this.newMenus[0].item_data = firstModule
      // }

      console.log(' this.directoryList', this.directoryList)
      console.log('wwwwwwwww1', this.newMenus)
      // 关闭弹窗
      console.log('111111111111111111111111111111', this.directoryList)
      this.question_varisible_item = false
      this.$forceUpdate()
      this.modified = true
      this.$store.dispatch('management/setSetmodified', true)
      // 操作数据显示撤销
      this.revocationIsshow = true
    },
    // 关闭添加变量弹框触发
    newaddVisibleClose() {
      // 清除数据
      this.$refs.newruleForm.clearValidate()
      this.newruleForm = {
        resource: '1', // 选项类型
        questionDescribe: [{ option_name: '' }]
      }
    },
    // 关闭批量操作触发
    newmostColse() {
      this.newmostData = ''
    },
    // 编辑变量组
    neweditVariables(e, parent) {
      console.log('用户点击进来就是编辑变量组', e, parent)
      if ('xxx' in e) {
        delete e.xxx
      }
      this.newmostDialogVisibles = true
      this.newmostDataList = e.question_name
      this.paramString = e.question_describe
      this.assignmentList = e
      // 将数据赋值上去 newmostDataList twoadddeloptions
    },
    // 编辑变量组点击确定
    twoadddeloptions() {
      this.$store.dispatch('management/setSetmodified', true)
      // 用户点击确定的时候需要将数据赋值上去
      console.log(this.assignmentList, this.newmostDataList)
      this.directoryList.forEach((directoryList) => {
        directoryList.second_item.forEach((second_item) => {
          second_item.question_lists.forEach((question_lists) => {
            if (question_lists.question_id === 0 && !question_lists.xxx) {
              question_lists.question_name = this.newmostDataList
              question_lists.question_describe = this.paramString
              question_lists.xxx = '编辑变量组新增的'
            } else {
              if (question_lists.question_id === this.assignmentList.question_id && !question_lists.xxx) {
                question_lists.question_name = this.newmostDataList
                question_lists.question_describe = this.paramString
              }
            }
          })
        })
      })
      this.newmostDialogVisibles = false
      // 操作数据显示撤销
      this.revocationIsshow = true
    },
    // 编辑变量
    neweditVariable(e, parent) {
      if (this.IsItOperable === 0) {
        // 如果进来说明用户还没新增数据量需要 弹出弹窗
        this.$emit('newspropWindows', true)
        return
      }
      console.log('用户点击编辑变量', e, parent)
      // this.$store.dispatch('management/setSetmodified', true)
      if (e.xxx) {
        delete e.xxx

        this.variableGroupxxx = e
        console.log('进来了', e, this.variableGroupxxx)
      }
      if (e.question_type === 1 || e.question_type === 2) {
        // newclickable
        console.log('寄哪里了')
        this.newclickable = true
      } else {
        this.newclickable = false
      }
      // 首先获取所有的目录信息
      const listManagement = this.$store.state.management.listManagement
      // 然后获取id
      const managementitem_id = this.$store.state.management.managementitem_id
      // 进来这里需要把前面的数据先拼接起来
      // 然后循环listManagement
      listManagement.forEach((management) => {
        // 判断是否有items
        // 如果有 那么说明目录有二级目录
        // 需要循环二级目录
        if (management.items.length >= 1) {
          management.items.forEach((items) => {
            // 判断items的item_id是否等于managementitem_id 如果等于说明等于的就是用户选中的目录
            if (items.item_id === managementitem_id) {
              // 如果等于了需要拿到一级目录加上自身
              console.log('二级目录等于了', management, items)
              // 将目录的数据存起来
              this.amendOptions = [
                {
                  item_name: management.item_name,
                  item_id: management.item_id,
                  relation_id: management.relation_id,
                  show_status: management.status,
                  dir_data: [
                    {
                      item_name: items.item_name,
                      item_id: items.item_id,
                      relation_id: items.relation_id,
                      show_status: items.status
                    }
                  ]
                }
              ]
            }
          })
        } else {
          // 如果不等于 说明该一级目录没有二级目录 需要判断自身
          if (management.item_id === managementitem_id) {
            // 如果等于说明该一级目录就是用户选中的目录
            console.log('用户选中的一级目录', management)
            this.amendOptions = [
              {
                item_name: management.item_name,
                item_id: management.item_id,
                relation_id: management.relation_id,
                show_status: management.status,
                dir_data: ''
              }
            ]
          }
        }
      })
      // this.obtainDirectory()
      // 拿到数据 调出弹窗 parent就是父级元素
      console.log(e)
      console.log('parent', parent)
      console.log(this.newruleForm)
      // 需要判断用户选中的是数据是否有一级变量
      // if (parent.child_question) {
      // 如果进来说明用户选中的是二级变量
      // 需要将一级变量拼接起来
      // console.log('如果进来说明用户选中的是二级变量', parent)
      // } else {
      // 如果进来这里说明没有,自身就是一级变量
      //  parent就是用户选中的二级模块
      // console.log('如果进来这里说明没有,自身就是一级变量', parent)
      // console.log('拿到目录', this.amendOptions)
      // if (e.option_list) {
      //   if (e.option_list !== '') {
      //     e.option_list.forEach((option_list, i) => {
      //       if (option_list.is_other === '1') {
      //         console.log('进来了', option_list)
      //         if (e.option_list[i].option_name.substring(e.option_list[i].option_name.length - 4) !== '____') {
      //           e.option_list[i].option_name = option_list.option_name + '____'
      //         }
      //       }
      //     })
      //   }
      // }
      this.optionRedact = e
      // }
      // console.log(' this.amendOptions', this.amendOptions)

      // 编辑首先将用户之前的内容赋值给弹窗
      // 需要判断用户选中的是哪一个类型
      this.newruleForm.resource = e.question_type.toString()
      this.newruleForm.name = e.question_name
      this.newruleForm.date1 = e.question_describe
      // 判断用户选中的类型
      if (this.newruleForm.resource === '1' || this.newruleForm.resource === '2' || this.newruleForm.resource === '3') {
        // 这里说明用户选中的是单选或者多选
        // 需要把选项赋值
        if (e.option_list) {
          // e.option_list.forEach((option_list, i) => {
          //   // 将值赋值给弹出层
          //   if (option_list.is_other === 1) {
          //     option_list.option_name += '____'
          //   }
          //   arr.push(option_list)
          // })
          const arr = JSON.parse(JSON.stringify(e.option_list))
          arr.forEach(option_list => {
            // 将值赋值给弹出层
            if (option_list.is_other === 1 || option_list.is_other === '1') {
              option_list.option_name += '____'
            }
          })
          // 深拷贝 数据赋值
          this.newruleForm.questionDescribe = arr
        }
      }
      console.log(' this.newruleForm', this.newruleForm, this.amendOptions)
      // this.$forceUpdate()
      this.newaddVisible = true
    },
    // 重置编辑弹框数据
    newaddClose() {
      this.newruleForm.questionDescribe = [{ option_name: '' }]
      this.EditVariableCancel()
    },
    // 删除模块
    removeModule(e) {
      console.log('删除模块', e)
      if ('xxx' in e) {
        delete e.xxx
      }
      // 需要判断用户选中的数据是否是二级模块
      // 这里需要拿到数据 e.question_id
      // 删除变量 将需要删除的数据存到vuex
      // 判断vuex中是否有数据 如果有就拿出来添加进去保存，
      // 如果没有就把数据直接添加进去
      if (this.$store.state.management.deletCatalogue.length >= 1) {
        var z = this.$store.state.management.deletCatalogue
        var list = []
        list.push(...z)
        let xx = 1
        z.forEach((z) => {
          if (z === e.item_id) {
            // 如果相等 就不管
            xx = 2
          } else {
            //
          }
        })
        if (xx === 1) {
          list.push(e.item_id)
        }
        console.log('lists', list)
        const information = []
        list.forEach((data) => {
          if (data !== 0) {
            information.push(data)
          }
        })
        this.$store.dispatch('management/setDeletCatalogue', information)
      } else {
        if (e.item_id !== 0 && !e.xxx) {
          this.$store.dispatch('management/setDeletCatalogue', [e.item_id])
        }
      }
      console.log('wwwwwwwwwwwwwwwwwwwwwwwwww', this.directoryList, e)
      // 需要把用户选中的n内容清空
      this.directoryList.forEach((directoryList, a) => {
        directoryList.second_item.forEach((second_item, b) => {
          if (second_item.item_id === e.item_id) {
            console.log('进来说明就是用户想删除的数据', second_item, this.directoryList[a].second_item[b])
            // question_lists = {}
            // this.directoryList[a].second_item[b] = {}
            this.directoryList[a].second_item.splice(b, 1)
          }
        })
      })
      console.log('this.directoryList', this.directoryList)
      this.$forceUpdate()
    },
    // 删除变量
    removeVariable(e) {
      console.log('删除变量', e)
      var childrens = []
      if (e.child_question) {
        e.child_question.forEach((child_question) => {
          childrens.push(child_question.question_id)
        })
      }
      if (this.$store.state.management.deleteMessages.length >= 1) {
        var z = this.$store.state.management.deleteMessages
        console.log('zzzz', z)
        var list = []
        list.push(...z)
        let xx = 1
        z.forEach((z) => {
          if (z === e.question_id) {
            // 如果相等 就不管
            xx = 2
          } else {
            // list.push(e.question_id)
          }
        })
        if (xx === 1) {
          // 如果等于1说明没有进去可以加
          if (e.child_question) {
            // console.log(childrens, '如果等于1说明没有进去可以加', list)
            list.push(e.question_id)
            list.push(...childrens)
          } else {
            list.push(e.question_id)
          }
        }
        console.log('lists', list)
        console.log('lists', list)
        const information = []
        list.forEach((data) => {
          if (data !== 0) {
            information.push(data)
          }
        })
        console.log('information', information)
        this.$store.dispatch('management/setDeleteMessages', information)
      } else {
        if (e.child_question) {
          const z = [e.question_id, ...childrens]
          const information = []
          z.forEach((data) => {
            if (data !== 0) {
              information.push(data)
            }
          })
          this.$store.dispatch('management/setDeleteMessages', information)
        } else {
          if (e.question_id !== 0) {
            this.$store.dispatch('management/setDeleteMessages', [e.question_id])
          }
        }
      }
      console.log(' this.directoryList', this.directoryList, e)
      // 渲染到页面
      this.directoryList.forEach((directoryList, a) => {
        directoryList.second_item.forEach((second_item, b) => {
          second_item.question_lists.forEach((question_lists, c) => {
            if (question_lists.child_question) {
              if (question_lists.question_id === e.question_id && question_lists.question_id !== 0) {
                // 如果进来就删掉
                this.directoryList[a].second_item[b].question_lists.splice(c, 1)
              } else {
                if (question_lists.question_id === 0 && !question_lists.xxx) {
                  // 如果进来就删掉
                  this.directoryList[a].second_item[b].question_lists.splice(c, 1)
                } else {
                  question_lists.child_question.forEach((child_question, d) => {
                    if (child_question.question_id === e.question_id && child_question.question_id !== 0) {
                      this.directoryList[a].second_item[b].question_lists[c].child_question.splice(d, 1)
                    }
                    if (child_question.question_id === e.question_id && child_question.question_id === 0 && !child_question.xxx) {
                      this.directoryList[a].second_item[b].question_lists[c].child_question.splice(d, 1)
                    }
                  })
                }
              }
            } else {
              if (question_lists.question_id === e.question_id && question_lists.question_key === e.question_key) {
              // 如果进来就删掉
                // this.directoryList[a].second_item[b].question_lists[c] = {}
                this.directoryList[a].second_item[b].question_lists.splice(c, 1)
              }
            }
          })
        })
      })
      this.$forceUpdate()
    },
    // 删除数据
    newdeleteVarisible(e) {
      console.log('eee', e)
      // 先校验是否删除
      this.$confirm('确定删除？', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(async() => {
        console.log('进来了吗')
        // 如果是那么需要判断用户删除的内容是否里面有数据 如果有就不能删除\
        if (e.question_lists) {
          if (e.question_lists.length >= 1) {
            // 如果有说明有数据不能删除
            this.$message.error('模块下有数据，删除失败')
            return
          }
          // 调用删除函数

          this.removeModule(e)
        } else {
          // if (e.child_question) {
          //   if (e.child_question.length >= 1) {
          //     return this.$message.error('变量组下面有数据，删除失败')
          //   }
          // }
          delete e.xxx
          this.removeVariable(e)
        }
        // question_arr
        this.modified = true
        this.$store.dispatch('management/setSetmodified', true)
        this.$message({
          type: 'success',
          message: '删除成功'
        })
      }).catch(() => {
        console.log('取消？？？')
        this.$message.info('已取消删除')
        // this.$message({
        //   type: 'info',
        //   messgae: '已取消删除'
        // })
      })
    },
    // 编辑变量弹框方法
    // 编辑单选多选输入框
    newaddSingleItem(id, index) {
      switch (id) {
        // 变量
        case 1:
          this.newruleForm.questionDescribe.push({ option_name: '' })
          break
        case 2:
          this.newruleForm.questionDescribe.push({ option_name: '其他____' })
          break
        // 题组
        case 3:
          console.log(3)
          this.newAddForm.varisibleItem[index].questionDescribe.push({
            text: ''
          })
          break
        default:
          this.newAddForm.varisibleItem[index].questionDescribe.push({
            text: '其他____'
          })
      }
    },
    // 减去单选多选输入框
    newminusSingleItem(id, index) {
      if (this.newruleForm.questionDescribe.length > 1) {
        this.newruleForm.questionDescribe.splice(index, 1)
      } else {
        this.$message.error('最少需要一个选项')
      }
    },
    // 这里是用户编辑变量点击取消
    EditVariableCancel() {
      console.log('这里是用户编辑变量点击取消', this.variableGroupxxx)
      if (this.variableGroupxxx.length !== 0) {
        const whetherisof = Object.prototype.hasOwnProperty.call(this.variableGroupxxx, 'xxx')
        //  !(this.variableGroupxxx.hasOwnProperty('xxx')
        if (!whetherisof && this.variableGroupxxx.question_id === 0) {
          console.log('进来了')
          this.directoryList.forEach((directoryList) => {
            directoryList.second_item.forEach((second_item) => {
              second_item.question_lists.forEach((question_lists) => {
                if (question_lists.child_question) {
                  question_lists.child_question.forEach((child_question) => {
                    if (child_question.question_id === 0 && !child_question.xxx) {
                      console.log('进来的就是需要添加的数据', child_question, this.variableGroupxxx)
                      child_question.xxx = '新增的！！'
                    }
                  })
                }
              })
            })
          })
        }
      }
      // 关闭弹窗
      this.newaddVisible = false
    },
    // 这里是用户编辑变量点击确定
    async EditVariableConfirm() {
      console.log('这里是用户编辑变量点击确定', this.amendOptions)
      /*
      第一步校验是否有数据
      如果没有数据直接结束给出用户提示
      然后拿到用户选中的数据 开始拼接数据
      这里因为是修改数据首先先拼接好最下面数据
      根据id一层一层的拼接

     */
      // 01校验数据不能为空
      // let is_pass
      // this.$refs.newruleForm.validate((valid) => {
      //   if (valid) {
      //     is_pass = true
      //   } else {
      //     is_pass = false
      //     return false
      //   }
      // })
      // if (!is_pass) return
      console.log('this.optionRedact ', this.optionRedact, this.newruleForm)
      if (this.newruleForm.name === '') {
        return this.$message.error('请输入变量名称')
      }
      if (this.newruleForm.resource === '1' || this.newruleForm.resource === '2' || this.newruleForm.resource === '3') {
        let z = 0
        this.newruleForm.questionDescribe.forEach((item) => {
          if (item.option_name === '') {
            z = 1
          }
        })
        if (z === 1) {
          return this.$message.error('选项不能为空')
        }
      }

      // 02 开始拼接数据 this.amendOptions
      // 因为在前面已经把其他内容拼接好
      // 这里是剩余用户修改的部分
      const newOptions = []
      // 这里就是选项
      const resOptions = []
      console.log('this.optionRedact ', this.optionRedact, this.newruleForm)
      // 首先判断用户改变的数据是否跟原来数据类型是一样的
      // 如果是一样的就需要带上以前的数据的question_id/relation_id
      // 如果用户选中的是单选多选下拉 需要将用户以前数据的id赋值到现在修改的id上。
      if (this.newruleForm.resource === '1' || this.newruleForm.resource === '2' || this.newruleForm.resource === '3') {
        // console.log('进来了吗？')
        // 进来这里需要在判断用户以前的数据是否是单选多选下拉
        if (this.optionRedact.question_type === 1 || this.optionRedact.question_type === 2 || this.optionRedact.question_type === 3) {
          // 然后如果相等
          this.newruleForm.questionDescribe.forEach((questionDescribe, i) => {
            // console.log('进来这里', questionDescribe)
            // 进来之后开始循环数据
            resOptions[i] = {}
            resOptions[i] = {
              option_id: questionDescribe.option_id === undefined ? 0 : questionDescribe.option_id,
              option_name: questionDescribe.option_name.substr(-4) === '____' ? questionDescribe.option_name.substring(0, questionDescribe.option_name.length - 4)
                : questionDescribe.option_name,
              is_other: questionDescribe.is_other === 1 ? 1 : questionDescribe.option_name.substr(-4) === '____' ? 1 : 0
            }
          })
        } else {
          // 这里就是需要修改的数据一开始不是单选多选下拉
          this.newruleForm.questionDescribe.forEach((questionDescribe, i) => {
            // console.log('进来这里', questionDescribe)
            // 进来之后开始循环数据
            resOptions[i] = {}
            resOptions[i] = {
              option_id: 0,
              option_name: questionDescribe.option_name.substr(-4) === '____' ? questionDescribe.option_name.substring(0, questionDescribe.option_name.length - 4)
                : questionDescribe.option_name,
              is_other: questionDescribe.option_name.substr(-4) === '____' ? 1 : 0
            }
          })
        }
        console.log('选项', resOptions)
      }

      console.log(' this.directoryList', this.directoryList)
      // 将数据渲染到页面
      // this.directoryList.forEach((directoryList) => {
      //   directoryList.
      // })
      // 创建变量保存信息
      // const newVariable = []
      // const twoVariable = [] // 二级变量
      // let newsparentID // 这里就是用户编辑变量组的时候判断的数据
      // 拿到渲染的数据开始循环
      this.directoryList.forEach((directoryList) => {
        // console.log('this.directoryList', directoryList)
        directoryList.second_item.forEach((second_item) => {
          if (second_item.question_lists) {
            second_item.question_lists.forEach((question_lists, i) => {
              // console.log('question_lists.question_typequestion_lists.question_typequestion_lists.question_type', question_lists.question_type === 0, question_lists)
              if (question_lists.question_type === 0) {
                console.log('如果不等于就来这里了吗')
                if (question_lists.child_question) {
                  question_lists.child_question.forEach((child_question) => {
                    if (child_question.question_id === 0 && child_question.question_id === this.optionRedact.question_id && !child_question.xxx) {
                      console.log('111', child_question)
                      child_question.question_describe = this.newruleForm.date1
                      child_question.question_name = this.newruleForm.name
                      child_question.question_id = this.optionRedact.question_id
                      child_question.relation_id = this.optionRedact.relation_id
                      child_question.show_status = this.optionRedact.show_status
                      child_question.question_type = this.newruleForm.resource
                      child_question.option_list = resOptions
                      // console.log('11111111111child_question.question_id === 0 && child_question.question_id === this.optionRedact.question_id && !child_question.xxx', child_question)
                    } else {
                      console.log('2222')
                      if (child_question.question_id === this.optionRedact.question_id && child_question.question_id !== 0) {
                        child_question.question_describe = this.newruleForm.date1
                        child_question.question_name = this.newruleForm.name
                        child_question.question_id = this.optionRedact.question_id
                        child_question.relation_id = this.optionRedact.relation_id
                        child_question.show_status = this.optionRedact.show_status
                        child_question.question_type = this.newruleForm.resource
                        child_question.option_list = resOptions
                      }
                    }
                  })
                } else {
                  // question_lists.child_question = ''
                }
              } else if (question_lists.question_id === this.optionRedact.question_id && question_lists.question_key === this.optionRedact.question_key) {
                console.log('进来了下面呀=================================', second_item, question_lists)
                second_item.question_lists.forEach((question_list, z) => {
                  newOptions[z] = {}
                  if (question_list.question_id !== 0) {
                    if (question_list.question_id === question_lists.question_id && question_list.question_key === this.optionRedact.question_key) {
                    // 进来这里说明就是用户修改的数据
                      // 渲染到页面
                      question_lists.question_name = this.newruleForm.name
                      question_lists.option_list = resOptions
                      question_lists.question_type = this.newruleForm.resource
                      question_lists.question_describe = this.newruleForm.date1
                    } else {
                      // if (question_list.option_list) {
                      //   newOptions[z] = question_list
                      // } else {
                      //   newOptions[z] = question_list
                      //   newOptions[z].option_list = ''
                      // }
                    }
                  } else {
                    if (!question_list.xxx && question_list.question_id === this.optionRedact.question_id) {
                      // console.log('进来这里说明就是修改的数据11111111111111111111111111111111111111111111', question_list)
                      // 进来这里说明就是修改的数据
                      // 渲染到页面
                      question_list.question_name = this.newruleForm.name
                      question_list.option_list = resOptions
                      question_list.question_type = this.newruleForm.resource
                      question_list.question_describe = this.newruleForm.date1
                      question_list.xxx = '修改的数据'
                    }
                  }

                  // }
                })
                // // 开始拼接数据
                // newVariable[0] = {
                //   // 一级模块
                //   item_name: directoryList.item_name,
                //   item_id: directoryList.item_id,
                //   relation_id: directoryList.relation_id,
                //   show_status: directoryList.show_status,
                //   item_data: [
                //     {
                //       //    二级模块
                //       item_name: second_item.item_name,
                //       item_id: second_item.item_id,
                //       relation_id: second_item.relation_id,
                //       show_status: second_item.show_status,
                //       question_data: newOptions
                //     }
                //   ]
                // }
              }
            })
          }
        })
      })
      this.$forceUpdate()
      console.log('拼接的结果', this.amendOptions, this.directoryList)
      // 关闭弹窗
      this.newaddVisible = false
      // 操作数据显示撤销
      this.revocationIsshow = true
      this.$store.dispatch('management/setSetmodified', true)
    },
    // 将数据存到vuex中
    saveData(amendOptions) {
      console.log('这里因为数据是多个所以跟以前的逻辑不一样', amendOptions)
      // if (this.$store.state.management.moduleSelected.length >= 1) {
      //   // this.$store.dispatch('management/setModuleSelected', )
      //   // 如果进入这里说明里面已经有数据
      //   // 需要循环vuex中数据 然后将修改的数据添加进去
      //   // 将vuex中数据拿到
      //   const z = this.$store.state.management.moduleSelected
      //   console.log('zzzzzzzzzzzzzzzz', z)
      //   if (z[0].dir_data.length >= 1) {
      //     // 如果进来说明有二级目录
      //     z[0].dir_data[0].item_data.forEach((item_data, one) => {
      //       amendOptions[0].dir_data[0].item_data.forEach((amenItemData) => {
      //         if (item_data.item_id === amenItemData.item_id) {
      //         // 如果相等说明vuex中已经有一级变量的数据
      //           console.log('如果相等说明vuex中已经有一级变量的数据', item_data, amenItemData)
      //           if (amenItemData.item_data !== '' && item_data.item_data !== '') {
      //             // 等于就有数据
      //             // 需要循环数据
      //             item_data.item_data.forEach((twoitemdata, two) => {
      //               amenItemData.item_data.forEach((twoamenitemdata) => {
      //                 // 判断二级的item_id是否相等
      //                 if (twoitemdata.item_id === twoamenitemdata.item_id) {
      //                   // 如果进来这里说明修改的数据有相等的
      //                   console.log('如果进来这里说明修改的数据有相等的', twoitemdata, twoamenitemdata)
      //                   // 将后面的数据添加进去 /////
      //                   z[0].dir_data[0].item_data[one].item_data[two].question_data = twoamenitemdata.question_data
      //                 } else {
      //                   // 如果不相等直接将数据push进去
      //                   z[0].dir_data[0].item_data[one].item_data.push(twoamenitemdata)
      //                 }
      //               })
      //             })
      //             console.log('等于就有数据')
      //             // 接着循环数据
      //           } else {
      //             console.log('不等于')
      //             // 不等于就判断谁有下一层
      //             if (amenItemData.item_data !== '') {
      //               // 这里就是用户选中的数据有二级模块
      //               z[0].dir_data[0].item_data[one].item_data.push(item_data.item_data)
      //             } else if (item_data.item_id !== '') {
      //               // 这里就是vuex中的数据有二级模块
      //               z[0].dir_data[0].item_data[one].item_data.push(amenItemData.item_data)
      //             } else {
      //               // 这里就是都没有不管
      //               z[0].dir_data[0].item_data[one].item_data = ''
      //             }
      //           }
      //         // if(item_data.)
      //         } else {
      //         // 如果不相等说明一级变量没有
      //           console.log('如果不相等说明一级变量没有', amenItemData)
      //           z[0].dir_data[0].item_data.push(amenItemData)
      //         }
      //       })
      //     })
      //   } else {
      //     z[0].item_data.forEach((item_data, one) => {
      //       amendOptions[0].item_data.forEach((amenItemData) => {
      //         if (item_data.item_id === amenItemData.item_id) {
      //         // 如果相等说明vuex中已经有一级变量的数据
      //           console.log('如果相等说明vuex中已经有一级变量的数据', item_data, amenItemData)
      //           if (amenItemData.item_data !== '' && item_data.item_data !== '') {
      //             // 默认是0
      //             let newsres = 0
      //             // z的下标
      //             let subscript = 0
      //             // 渲染的数据的下标
      //             let anmSubscript = 0
      //             let anmSubscripts = 0
      //             // 等于就有数据
      //             // 需要循环数据
      //             item_data.item_data.forEach((twoitemdata, two) => {
      //               amenItemData.item_data.forEach((twoamenitemdata, index) => {
      //                 // 判断二级的item_id是否相等
      //                 if (twoitemdata.item_id === twoamenitemdata.item_id) {
      //                   // 只要相等就改变成1
      //                   newsres = 1
      //                   subscript = two
      //                   anmSubscript = index
      //                   // 如果进来这里说明修改的数据有相等的
      //                   console.log('如果进来这里说明修改的数据有相等的', twoitemdata, twoamenitemdata)
      //                   // 将后面的数据添加进去 /////
      //                   // z[0].item_data[one].item_data[two].question_data = twoamenitemdata.question_data
      //                 } else {
      //                   anmSubscripts = index
      //                   // 如果不相等直接将数据push进去
      //                   console.log('如果不相等直接将数据push进去', twoitemdata, twoamenitemdata)
      //                   // z[0].item_data[one].item_data.push(twoamenitemdata)
      //                 }
      //               })
      //             })
      //             // 当数据进去的时候就需要添加数据

      //             console.log('等于就有数据')
      //             if (newsres === 1) {
      //               // 如果进来这里说明就是有数据
      //               console.log('新增进来了', subscript, anmSubscript, amenItemData)
      //               z[0].item_data[one].item_data[subscript].question_data = amenItemData.item_data[anmSubscript].question_data
      //             } else {
      //               // 这里就是没有直接push
      //               console.log('这里就是没有直接push', anmSubscripts, amenItemData)
      //               z[0].item_data[one].item_data.push(amenItemData.item_data[anmSubscripts])
      //             }
      //             // 接着循环数据
      //           } else {
      //             console.log('不等于')
      //             // 不等于就判断谁有下一层
      //             if (amenItemData.item_data !== '') {
      //               // 这里就是用户选中的数据有二级模块
      //               z[0].item_data[one].item_data.push(item_data.item_data)
      //             } else if (item_data.item_id !== '') {
      //               // 这里就是vuex中的数据有二级模块
      //               z[0].item_data[one].item_data.push(amenItemData.item_data)
      //             } else {
      //               // 这里就是都没有不管
      //               z[0].item_data[one].item_data = ''
      //             }
      //           }
      //         // if(item_data.)
      //         } else {
      //         // 如果不相等说明一级变量没有
      //           console.log('如果不相等说明一级变量没有', amenItemData)
      //           z[0].item_data.push(amenItemData)
      //         }
      //       })
      //     })
      //   }
      //   console.log('zzzzzzzzz', z)
      //   this.$store.dispatch('management/setModuleSelected', z)
      // } else {
      //   console.log('没数据时', amendOptions)
      //   this.$store.dispatch('management/setModuleSelected', amendOptions)
      // }
    }
  }
}
</script>
<style>
/* 设置滚动条的样式 */
::-webkit-scrollbar {
width:12px;
}
/* 滚动槽 */
::-webkit-scrollbar-track {
box-shadow:inset006pxrgba(0,0,0,0.3);
border-radius:10px;
}
/* 滚动条滑块 */
::-webkit-scrollbar-thumb {
border-radius:10px;
background:rgba(0,0,0,0.1);
box-shadow:inset006pxrgba(0,0,0,0.5);
}
</style>
<style lang="scss" scope>
// ::-webkit-scrollbar {
//   width: 0 !important;
// }
// ::-webkit-scrollbar {
//   width: 0 !important;
//   height: 0;
// }
// 选中样式
.select-module{
   background: rgba(22, 132, 252, 0.16) !important;
   color: #3593f8 !important;
}
.navthiss {
  // overflow-x:scroll;
  // white-space: nowrap

}
// 选中拖动的样式
// 新增
.navthiss-chose-class-module{
  border: solid 1px #2e8fff !important;
  min-height: 50px;
  cursor: move !important;
}
.navthiss-chose-class{
  border: solid 1px #2e8fff !important;
  min-width:50% !important;
  min-height: 50px;
  cursor: move !important;

}
// 模块/变量
.chose-child-class{
  border: solid 1px #2e8fff !important;
}
// =================================
.grid-content-align .el-radio{
  white-space: normal;
}
// 自动适应布局row/eol
// 表格样式
.tool {
  display: flex;
  align-items: flex-start;
}
.wrap-main{
  min-height:60px;
  border: 1px solid rgba(220, 223, 230, 0.5);
}
  .grid-main{
    width: 100%;
  }
  .grid-child{
    // border-top: 1px solid #cdcdcd;
    height: 100%;
    .grid-child-row{
      height: 100%;
    }
  }
  .grid-content {
    min-height: 50px;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    flex-wrap: wrap;
    border-left: 1px solid rgba(220, 223, 230, 0.5);
  }
  .grid-content-name-align-left{
    height:100%;width:90%;display:flex;align-items:center;white-space: normal;
  }
  .grid-content-name-align{
  height: 100%;
  margin-left: 20px;
  display: flex;
  justify-content: space-between;
}
.grid-content-align{
  width: 100%;
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  padding: 10px;
}
// 创建成功
.create-success {
  position: fixed;
  top: 0;
  height: 50px;
  width: 180px;
  right: 48px;
  .childcreate-success {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    height: 50px;
    .revocation{
      cursor:pointer
    }
    .btnrevocation{
      width: 99px;
      height: 38px;
      background-color: #409eff;
      display: flex;
      align-items: center;
      justify-content: center;
      border-radius: 5%;
      cursor:pointer

    }
    .btnrevocations:hover .btnpreserve span{
      color: #409eff;
    }
  }
}

.noData {
  width: 150px;
  height: 150px;
  font-size: 16px;
}
.noData img {
  width: 120px;
  height: 120px;
}
.noData-1 {
  width: 120px;
  height: 30px;
  line-height: 30px;
  text-align: center;
  color: #cdcdcd;
}
.noData-2 {
  display: flex;
  justify-content: center;
  align-items: center;
}
.bgc_w_varid {
  position: relative;
  padding: 9px 15px;
  line-height: 20px;
  font-size: 14px;
}

.nameStyle {
  width: 20%;
  height: 100%;
  padding: 7% 0 0 5%;
  border-right: 1px solid #e6e6e6;
}
.nameStyles {
  width: 16%;
  height: 100%;
  padding: 4% 0 0 4%;
  border-right: 1px solid #e6e6e6;
}
.detailsStyle {
  flex: 1;
  padding-left: 2%;
}
.newVariable {
  width: 100%;
  display: flex;
  align-items: center;
  height: 100%;
  border-bottom: 1px solid #e6e6e6;
  border-right: 1px solid #e6e6e6;
}
.wrap {
  background: white;
}
// 添加模块和变量
.navthiss {
  height: 90vh;
  width: 261px;
  position: fixed;
  right: 1%;
  top: 70px;
  z-index: 99;
  border: none;
  overflow-y: scroll !important;
  padding-right:30px;
  background-color: #f7f7f7;
  .navthiss-header {
    top: 70px;
    padding-right:30px;
    position: fixed;
    right: 1%;
    z-index: 100;
    margin: 0;
    height: 50px;
    width: 261px;
    display: flex;
    background: #f7f7f7;
    justify-content: center;
    div {
      background: #f7f7f7;
      height: 100%;
      line-height: 50px;
      width: 50%;
      text-align: center;
    }
    .navthiss-header-select {
      font-weight:700;
      background: #fff;
    }
  }
  .navthiss-content {
    padding-bottom: 200px;
    background: #fff;
    padding-top: 50px;
    width: 231px;
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;

  }
  .navthiss-content-add {
    width: 180px;
    height: 36px;
    margin: 15px 0;
    display: flex;
    justify-content: center;
    align-items: center;
    border: 1px solid rgba(46, 143, 255, 1);
    color: rgba(46, 143, 255, 1);
    border-radius: 40px;
  }
  .wrap {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    .navthiss-content-item2 {
      padding-left: 10px;
      cursor: move !important;
      width: 100%;
      min-height: 36px;
      line-height: 20px;
      color: black;
      white-space: normal;
      display: flex;
      align-items: center;
    }
  }
}

// 二级变量名
.item-name {
  border: 1px solid rgba(220, 223, 230, 0.5);
  width: 100%;
  height: 50px;
  line-height: 50px;
  padding-left: 5px;
  padding-right: 15px;
  font-weight: normal;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
// 添加题组
.varisible-item .el-form-item__content {
  margin: 0 !important;
}
.dimensionless{
  font-size: 16;
}
.border-b-none{
  border-left: none;
}
</style>
